阅读:4438回复:2
请问nginx的配置文件nginx.conf在哪里?
/usr/local下的才是你正在使用的配置文件,/etc/nginx那个只是默认的配置, nginx -t 如果没有加-c指定配置文件,则测试的是默认配置文件
安装方式不同导致的,使用 wget 安装的配置文件在 /usr/local/nginx/conf,使用 yum 安装的配置文件在 /etc/nginx下。 你可以分别使用这两种方式安装看下路径. |
|
沙发#
发布于:2022-01-11 16:40
locate nginx.conf
可以查看所有的nginx.conf; systemctl status nginx 查看nginx当前的状态; 启动nginx时可以使用-c配置项指定配置文件 sudo nginx -c /etc/nginx/nginx.conf nginx # 直接启动 nginx -s reload # 重启 或者 cd /usr/local/nginx/sbin 然后 ./nginx -s reload |
|
板凳#
发布于:2022-01-11 16:55
Nginx如何更改conf配置文件 安装Nginx默认的配置文件路径: /usr/local/nginx/conf/nginx.conf 默认的ngnix.conf: user nobody; worker_processes 8; pid log/nginx.pid; events { use epoll; worker_connections 100000; } worker_rlimit_nofile 100000; http { include mime.types; default_type application/octet-stream; server_tokens off; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 0; fastcgi_connect_timeout 30; fastcgi_send_timeout 30; fastcgi_read_timeout 30; fastcgi_buffer_size 1k; fastcgi_buffering off; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml text/javascript; gzip_vary on; charset utf-8; access_log off; log_not_found off; error_page 400 403 405 408 /40x.html ; error_page 500 502 503 504 /50x.html ; server { listen 80; server_name aaicourt.qcloud.com; client_max_body_size 100M; root /data/qcloud/proxy/www; access_log /data/qcloud/proxy/log/weblog/access.log; error_log /data/qcloud/proxy/log/weblog/error.log; location / { index index.php index.html index.htm; if (-d $request_filename) { rewrite ^(/.*[^/])$ $1/index.php; } } rewrite ^/([a-zA-Z0-9]+)$ / last; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ voice.cgi { fastcgi_pass 127.0.0.1:3001; fastcgi_index index.cgi; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ register.cgi { fastcgi_pass 127.0.0.1:3002; fastcgi_index index.cgi; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ inner.cgi { fastcgi_pass 127.0.0.1:3003; fastcgi_index index.cgi; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SERVER_NAME $http_host; include fastcgi_params; fastcgi_ignore_client_abort on; fastcgi_connect_timeout 600s; fastcgi_send_timeout 600s; fastcgi_read_timeout 600s; } location ~ /.svn/ { deny all; } } } 我们现在开始更改,使此配置文件与更多的配置文件相关联。(用代码编辑器即可修改) 主要是跟最后面的include有关,情况nginx.conf 2、修改完nginx.conf,最好是用命令(先测试配置是否有语法错误,然后重载配置): sudo nginx -t sudo service nginx reload 3、如果测试配置的时候报错:nginx: [emerg] unexpected "}" in /etc/nginx/nginx.conf:70 一般是这几种情况:nginx.conf文件中的第70行或第69行,1)有非法字符,比如忘记用#的注释,2)多了或少了一个}字符,3)配置语句少了分号结尾 ———————————————— 版权声明:本文为CSDN博主「哆啦Ci梦」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/u010046615/article/details/110197556 |
|