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

安装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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值