nginx 配置信息:
/usr/local/nginx/conf
进入 cd /usr/local/nginx/sbin/
查看版本:./nginx -v
启动:./nginx
停止:./nginx -s stop
重新加载:./nginx -s reload
redis 配置信息:
cd /opt/fmh/redis/redis-5.0.8 下的 redis.conf
要远程访问把这个注释:bind 127.0.0.1
要后台启动把这个改成yes: daemonize yes
要设置密码:requirepass foobared
前台启动:cd /opt/fmh/redis/redis-5.0.8/src 后 ./redis-server
后台启动(前提是要把后台启动daemonize打开):cd /opt/fmh/redis/redis-5.0.8/src 后 ./redis-server ../redis.conf
前端修改代码:
vue.config.js =================
// 例如 https://www.fmh.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.fmh.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/fmh/" : "/",
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir: 'fmh',
router/index.js ===================
base: 'fmh',
layout/components/Navbar.vue ======================
this.$store.dispatch('LogOut').then(() => {
location.href = '/fmh/index';
})
nginx 修改 nginx.conf
server {
listen 80;
server_name 192.168.101.50;
location /images/ {
root /opt/fmh/upload/;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /fmh {
root /opt/fmh/projects/fmh;
try_files $uri $uri/ @router;
index index.html index.htm;
proxy_set_header x-forwarded-for $remote_addr;
}
location @router{
rewrite ^.*$ /fmh/index.html last;
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8866/;
}
}