我们搜索一下 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
来源: http://www.bubuko.com/infodetail-3340549.html