咱們搜索一下yum庫關於nginx的rpm包:yum list | grep nginxhtml
找到rpm安裝包,咱們就能夠使用yum直接安裝了:yum install nginxnginx
修改nginx配置文件:vi /etc/nginx/nginx.confspa
註釋掉下面的配置:code
# server { # listen 80 default_server; # listen [::]:80 default_server; # server_name _; # root /usr/share/nginx/html; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # error_page 404 /404.html; # location = /40x.html { # } # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # }
建立一個netcore.conf配置文件:vi /etc/nginx/conf.d/netcore.confserver
添加配置:htm
server { listen 80; location / { proxy_pass http://localhost:81; } }
啓動nginx:systemctl start nginxblog
經常使用命令,重啓nginx:io
nginx -s reloadclass