nginx 命令说明
#启动命令
./sbin/nginx -c ./conf/nginx.conf
#验证配置是否正确
./nginx -t
回显test is successful说明配置正确
第二种方法 ./sbin/nginx -t -c ./conf/nginx.conf
#停止nginx
./sbin/nginx -s stop
ps -ef|grep nginx
kill -15 进程号 正常停止
kill -9 进程号 强制停止
#重新加载配置文件
./sbin/nginx -s reload
#重启服务
./sbin/nginx -s reopen
#显示版本号
./sbin/nginx -v
#配置前端代理
# another virtual host using mix of IP-, name-, and port-based configuration
server {
listen 9016;
server_name 172.38.30.43;
root /home/dist/;
index index.html;
location / {
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
location /user-center {
proxy_pass http://172.38.30.43:8180/user-center;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}