nginx.conf 配置文件
时间: 2023-07-06 07:28:31 浏览: 53
以下是一个简单的 Nginx 配置文件示例:
```
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
```
该配置文件中定义了一个 Nginx 服务器,监听 80 端口,将访问根路径 `/` 映射到 `/usr/share/nginx/html` 目录下的 `index.html` 或 `index.htm` 文件。同时定义了错误页面的处理方式。
当然,根据实际需求,您可以根据需要自行修改配置文件。请注意备份原始配置文件,以避免修改配置文件后出现问题。