美文网首页
nginx集群安装+启动过程(Nacos集群一)

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

作者: lbjfish | 来源:发表于2020-08-26 13:19 被阅读0次

    安装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
    

    相关文章

      网友评论

          本文标题:nginx集群安装+启动过程(Nacos集群一)

          本文链接:https://www.haomeiwen.com/subject/neyxsktx.html