码迷,mamicode.com
首页 > 其他好文 > 详细

nginx配置初步

时间:2018-04-24 11:13:04      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:agent   reload   oct   目录   http   name   location   查看   ica   

nginx配置初步

1,切换至nginx目录,找到配置文件目录

cd /etc/nginx/conf.d

2,拷贝一份conf文件

sudo cp default.conf head.conf

3,进行conf文件的配置

server{
        listen 80;
        server_name head.cmbc.com.cn;
        proxy_intercept_errors on;
        error_page 404 403 401 /error/40x.html;
        location / {
                proxy_pass http://127.0.0.1:9100;
                include proxy.conf;
        }

}

4,进行nginx配置测试 

sudo nginx -t

5,进行nginx重新启动

sudo nginx -s reload

6,查看上一级目录中的配置

cd ..

cat nginx.conf

user www;
worker_processes 2;

#pid  logs/nginx.pid;
events{
        worker_connections 1024;
}

http{
        include mine.types;
        default_type application/octet-stream;

        log_format main 
 ‘$remote_addr-$remote_user[$time_local]"$request"‘
                                ‘$status $body_bytes_sent "$http_referer"‘
                                ‘"$http_user_agent" "$http_x_forworded_for" "$request_time"‘;

        access_log /var/log/nginx/access.log main;

        sendfile     on;
        keepalive_timeout 65;

        gzip on;
        gzip_static on;
        gzip_vary on;
        gzip_http_version 1.0;
        gzip_proxied any;
        gzip_disable "MSIE [1-6]\.";
        gzip_comp_level 5;
        gzip_min_length 1000;
        gzip_buffers  4 16k;
        gzip_types text/plain application/javascript text/javascript application/x-javascript text/css text/xml;

        include conf.d/*.conf;  #这句就说明包含了conf.d下面所有的conf文件

}

 

nginx配置初步

标签:agent   reload   oct   目录   http   name   location   查看   ica   

原文地址:https://www.cnblogs.com/stono/p/8926117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!