Linux服務器部署.Net Core筆記:五、安裝Nginx


我們搜索一下yum庫關於nginx的rpm包:yum list | grep nginx

找到rpm安裝包,我們就可以使用yum直接安裝了:yum install nginx

修改nginx配置文件:vi /etc/nginx/nginx.conf

注釋掉下面的配置:

#    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.conf

添加配置:

server {
    listen 80;
    location / {
        proxy_pass http://localhost:81;
    }
}

啟動nginx:systemctl start nginx

常用命令,重啟nginx:

nginx -s reload

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM