查出nginx所在目录
ps -ef|grep nginx
重新加载配置
/usr/sbin/nginx -s reload
启动
直接nginx
Nginx rewrite 和 proxy_pass共用
地址栏会发生变化
server {
listen 19001;
server_name localhost;
charset UTF-8;
client_max_body_size 1000m;
location /tmp/img {
rewrite ^/tmp/img/(.)$ http://100...:9001/$1;
}
}
地址栏不会发生变化
server {
listen 19001;
server_name localhost;
charset UTF-8;
client_max_body_size 1000m;
location /tmp/img {
# /$1的意思是, 先将 /tmp/img 删除, 只保留其后面的路径
rewrite ^/tmp/img/(.)$ /$1 break;
# 改写完之后, 再进行代理; 最终结果: http://100...:9001/$1
proxy_pass http://100...*:9001;
}
}
location /ag-crm-server/ {
rewrite ^/ag-crm-server/(.*)$ /ag-crm-server/$1 break;
proxy_pass http://sp.xxxxxx.com:8090;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}