您的位置:首页 > 运维架构 > Nginx

Nginx学习笔记

2018-01-09 14:26 190 查看
命令:

启动:start nginx

检查配置是否正确:nginx -t

修改配置后重载:nginx -s reload

关闭:nginx -s stop

nginx+tomcat整合

配置文件 nginx.conf里

server {

        listen       80;

        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {

            root   html;

            index  index.html index.htm;

        }

修改为:

server {

        listen       80;

        server_name  localhost:8080;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {

            proxy_pass http://localhost:8080;
        }

 但是访问tomcat响应很慢,修改为:

        location / {

            proxy_pass http://localhost:8080;
            proxy_set_header Host $http_host;

            proxy_set_header X-Real-IP $remote_addr;

            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            client_max_body_size 1000m;

            proxy_connect_timeout 1;

            proxy_send_timeout 30;

            proxy_read_timeout 60;

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  学习笔记