nginx 配置说明

74 阅读1分钟

vue.config.js

image.png

router.jsvue.config.js名称一样

image.png

nginx.conf

	location /smartroom {
            alias   html/smartroom;
            index  index.html;
            try_files $uri $uri/smartroom/ /smartroom/index.html;
        }
        
        
          location /v1 {
            #proxy_pass http://scg;
      			proxy_pass http://10.110.100.89:8088;
      			proxy_http_version 1.1;
      			proxy_set_header Connection "";
            proxy_set_header Host $host;
            proxy_set_header User-Agent $http_user_agent;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
        }

附加一些nginx 常用命令

kill -TERM 进程号    :快速停止Nginx

 cd /usr/local/nginx/sbin/     //进入该目录

./nginx    //重启

ps -ef | grep nginx // 查看进程

nginx -s reload  :修改配置后重新加载生效

nginx -s reopen  :重新打开日志文件
nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确
关闭nginx:
nginx -s stop  :快速停止nginx
         quit  :完整有序的停止nginx
其他的停止nginx 方式:
ps -ef | grep nginx
kill -QUIT 主进程号     :从容停止Nginx
kill -TERM 主进程号     :快速停止Nginx
pkill -9 nginx          :强制停止Nginx
启动nginx:
nginx -c /usr/local/nginx/conf/nginx.conf