nginx 的server配置头

server {
    listen 80;
    # server_name _;
# server_name  www.ccccc.com;
    access_log  /data/ nginx.log combined;
    index /app/user/index.html;
    location ^~ /app/ {  
            proxy_pass http://127.0.0.1:8080;  
    }
}

以上配置做了:

监听80端口且host是admin.ccccc.com的请求

会将请求日志放到/data/ nginx.log里面.错误日志也在那里

如果只是单纯地访问admin.ccccc.com,系统会自动添加后缀成为admin.ccccc.com/app/user/index.html内部再来一次.

如果包括app,则转发到8080端口.

如果配置server_name _,那么意味着过来的host都接(如果是域名的话,当然dns也得解析到这个ip上啊).

server的index会晚于后面的location配置,如果location有关于 纯域名的配置,那么这个index就没有了作用.

发布了514 篇原创文章 · 获赞 182 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/dmw412724/article/details/103261383