我想将URL: http://192.168.10.10/zabbix 代理为monitor.test.com.cn; 哪位大哥指定下,nginx官方文档看太懂
我的nginx配置文件如下:
server
{
listen 80;
server_name monitor.test.com.cn;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.10.10/zabbix;
}
access_log logs/monitor_access.log;
}
这是我的配置,可以参考下 server {
listen 80;
server_name localhost;
charset utf-8;
#charset koi8-r;
#access_log logs/host.access.log main;
# 静态页面目录
#root E:\workspace\NBDP-team;
# 默认首页
#index index.html index.htm;
location / {
# 静态页面目录
root E:\workspace\NBDP-team;
# 默认首页
index index.html index.htm;
#proxy_pass http://10.226.126.32:8088;
# 用户浏览器端的缓存设置
location ~* \.(css|js|jpg|jpeg|gif|png|swf|htm|html|json|xml|svg|woff|ttf|eot|map|ico)$ {
expires 1h;
if (-f $request_filename) {
root E:\workspace\NBDP-team;
expires 30d;
break;
}
}
# 动态页面,交给tomcat处理
if ( !-e $request_filename) {
proxy_pass http://10.226.126.32:8088;
}
}
你可以看我博客,希望对你有帮助