nginx简单操作命令
nginx // 启动
nginx -s reload // 重启
nginx -s stop // 停止
常用集合
一、移除前缀代理
// 效果: /t1/api/test -> /api/test
location /t1/ {
rewrite ^/t1/(.*)$ /$1 break;
proxy_pass http://localhost:8080;
}
二、代理到指定文件-常用于服务器代理多个项目
// 假设域名路径 test.baidu.com/test
location /test {
alias /www/wwwroot/test.baidu.com/test;
try_files $uri $uri/ /test/index.html;
}