nginx配置初步
Posted stono
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx配置初步相关的知识,希望对你有一定的参考价值。
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配置初步的主要内容,如果未能解决你的问题,请参考以下文章