# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf;
include /etc/nginx/mime.types; default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf;
server { listen80; listen [::]:80; server_name _; root /usr/share/nginx/html;
# Load configuration files for the default server block. include /etc/nginx/default.d/*.conf;
systemctl start nginx.service systemctl stop nginx.service systemctl reload nginx.service systemctl status nginx.service service nginx start systemctl enable nginx
启动以后类似下面的输出
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2021-06-30 21:25:38 CST; 4s ago Process: 2231 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) Process: 2228 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS) Process: 2227 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 2233 (nginx) CGroup: /system.slice/nginx.service ├─2233 nginx: master process /usr/sbin/nginx └─2235 nginx: worker process Jun 30 21:25:38 VM-0-13-centos systemd[1]: Starting The nginx HTTP and reverse proxy server... Jun 30 21:25:38 VM-0-13-centos nginx[2228]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok Jun 30 21:25:38 VM-0-13-centos nginx[2228]: nginx: configuration file /etc/nginx/nginx.conf test is successful Jun 30 21:25:38 VM-0-13-centos systemd[1]: Started The nginx HTTP and reverse proxy server.