Nginx 常用命令
nginx 启动
nginx -s stop 停止
nginx -s quit 安全退出
nginx -s reload 重新加载配置文件
ps aux|grep nginx 查看nginx进程
Nginx 的默认配置
worker_processes 1; # Nginx 进程数,一般设置为和 CPU 核数一样
events {
worker_connections 1024; # 每个进程允许最大并发数
}
http {
include mime.types; # 文件扩展名与类型映射表
default_type application/octet-stream;
sendfile on; # 开启高效传输模式
keepalive_timeout 65; # 保持连接的时间,也叫超时时间,单位秒
server {
listen 8080; # 配置监听的端口
server_name localhost; # 配置的域名
location / {
root html; # 网站根目录
index index.html index.htm; # 默认首页文件
}
error_page 500 502 503 504 /50x.html; # 默认50x对应的访问页面
location = /50x.html {
root html;
}
}
include servers/*; # 加载子配置项
}