2024-05-07 06:04:12 -04:00
|
|
|
# 全局配置
|
|
|
|
user root;
|
|
|
|
worker_processes auto;
|
|
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
pid /var/run/nginx.pid;
|
|
|
|
|
|
|
|
# 事件处理
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
# HTTP 服务器
|
|
|
|
http {
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
# HTTP 服务器监听端口
|
|
|
|
server {
|
|
|
|
listen 3001;
|
|
|
|
|
|
|
|
# 服务器名称
|
|
|
|
server_name localhost;
|
|
|
|
# 访问日志路径
|
|
|
|
access_log /var/log/nginx/access.log;
|
2024-05-08 02:15:59 -04:00
|
|
|
# 站点根目录
|
|
|
|
root /usr/share/nginx/html;
|
2024-05-07 06:04:12 -04:00
|
|
|
# 代理配置
|
|
|
|
location / {
|
|
|
|
# 默认页面
|
|
|
|
index index.html index.htm;
|
2024-05-08 02:15:59 -04:00
|
|
|
try_files $uri $uri.html $uri/ =404;
|
2024-05-07 06:04:12 -04:00
|
|
|
# try_files $uri $uri/ =404;
|
|
|
|
}
|
2024-05-08 02:15:59 -04:00
|
|
|
location /task/ {
|
|
|
|
rewrite ^/task/(.*)$ /task/$1.html break;
|
|
|
|
}
|
2024-05-07 06:04:12 -04:00
|
|
|
# 静态文件缓存配置
|
|
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
|
|
|
|
expires 7d;
|
|
|
|
access_log off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|