nginx集群安装+启动过程(Nacos集群一)

2020-08-26  本文已影响0人  lbjfish

安装nginx

1.用yum安装,执行命令:

yum install -y nginx

2.默认安装路径是:
/usr/sbin/nginx
3.默认配置路径是:
/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是否启动服务(现在是启动后样子,如果启动了,就不需要下面的操作了):

[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
上一篇下一篇

猜你喜欢

热点阅读