centos7下nginx配置文件
时间: 2023-08-20 21:10:24 浏览: 116
Centos7下nginx的安装与配置教程详解
在CentOS 7下,Nginx的配置文件位于`/etc/nginx/nginx.conf`。你可以使用任何文本编辑器打开该文件进行配置。
以下是一个简单的示例配置文件:
```
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.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_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
```
你可以根据你的需求进行修改和扩展。记得在修改配置文件后重启Nginx服务,使用以下命令:
```
sudo systemctl restart nginx
```
阅读全文