亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

Linux——CentOS7使用nginx反向代理8080端口到80端口

找到nginx.conf
[www@VM_183_120_centos ~]$ whereis nginx.conf  //先找到nginx.conf
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz
[www@VM_183_120_centos ~]$ cd /etc/nginx  //根据上面找到的路径我们进入
[www@VM_183_120_centos nginx]$ ll    //查看
total 68
drwxr-xr-x 2 root root 4096 Oct 31 20:32 conf.d
drwxr-xr-x 2 root root 4096 Oct 31 20:32 default.d
-rw-r--r-- 1 root root 1077 Oct 31 20:39 fastcgi.conf
-rw-r--r-- 1 root root 1077 Oct 31 20:39 fastcgi.conf.default
-rw-r--r-- 1 root root 1007 Oct 31 20:39 fastcgi_params
-rw-r--r-- 1 root root 1007 Oct 31 20:39 fastcgi_params.default
-rw-r--r-- 1 root root 2837 Oct 31 20:39 koi-utf
-rw-r--r-- 1 root root 2223 Oct 31 20:39 koi-win
-rw-r--r-- 1 root root 3957 Oct 31 20:39 mime.types
-rw-r--r-- 1 root root 3957 Oct 31 20:39 mime.types.default
-rw-r--r-- 1 root root 2467 Oct 31 20:39 nginx.conf         //在这里
-rw-r--r-- 1 root root 2656 Oct 31 20:39 nginx.conf.default
-rw-r--r-- 1 root root  636 Oct 31 20:39 scgi_params
-rw-r--r-- 1 root root  636 Oct 31 20:39 scgi_params.default
-rw-r--r-- 1 root root  664 Oct 31 20:39 uwsgi_params
-rw-r--r-- 1 root root  664 Oct 31 20:39 uwsgi_params.default
-rw-r--r-- 1 root root 3610 Oct 31 20:39 win-utf
[www@VM_183_120_centos nginx]$ su
Password: 
[root@VM_183_120_centos nginx]# vi nginx.conf  //开始编辑配置文件
更改配置文件
 server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  127.0.0.1:8080;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
         proxy_pass   http://127.0.0.1:8080;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

然后输入nginx -s reload重启nginx ,就可以直接通过ip/域名访问8080端口了。

點擊查看更多內容
6人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
全棧工程師
手記
粉絲
218
獲贊與收藏
1546

關注作者,訂閱最新文章

閱讀免費教程

感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消