Nginx 配置笔记
Nginx 配置写多了有些细节总记不住,统一整理在这里。 安装 # Debian/Ubuntu sudo apt install nginx # Arch Linux sudo pacman -S nginx # 启动 sudo systemctl enable --now nginx 配置文件结构 /etc/nginx/ ├── nginx.conf # 主配置文件 ├── conf.d/ # 通常在这里放站点配置 └── sites-enabled/ # 部分发行版用这个目录 nginx.conf 主体结构: worker_processes auto; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include conf.d/*.conf; } 静态站点 server { listen 80; server_name example.com; root /var/www/html; index index.html; location / { try_files $uri $uri/ =404; } } HTTPS 配置 有了证书之后: ...