nginx集群安裝+啟動過程(Nacos集群一)

安裝nginx

1.用yum安裝,執(zhí)行命令:

yum install -y nginx

2.默認(rèn)安裝路徑是:
/usr/sbin/nginx
3.默認(rèn)配置路徑是:
/etc/nginx
4.自定義nacos配置(mynacos.conf):
[root@localhost conf.d]# ls
default.conf mynacos.conf

upstream cluster{
        server 192.168.128.30:8848;
        server 192.168.128.21:8848;
        server 192.168.128.22:8848;
   }

    server {
        listen       80;
        server_name  dhgate.nacos.internal;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
           # root   html;
           # index  index.html index.htm;
           proxy_pass http://cluster;
        }
}

啟動nginx

1.先查看nginx是否啟動服務(wù)(現(xiàn)在是啟動后樣子,如果啟動了,就不需要下面的操作了):

[root@localhost conf.d]# ps -ef | grep "nginx"
root      5353     1  0 11:11 ?        00:00:00 nginx: master process nginx
nginx     5354  5353  0 11:11 ?        00:00:00 nginx: worker process
root      5461  5265  0 11:16 pts/0    00:00:00 grep --color=auto nginx

2.先查詢nginx的安裝目錄:

[root@localhost local]# which nginx
/usr/sbin/nginx

or (whereis 包含安裝 和 配置路徑)

[root@localhost conf.d]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz

3.查詢nginx配置文件目錄:

[root@localhost conf.d]# find /|grep nginx.conf
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/mynacos.conf
/etc/nginx/nginx.conf
/etc/nginx/nginx.conf.bak

4.啟動nginx命令:

nginx -c /etc/nginx/nginx.conf
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容