美文网首页
Nginx基本使用

Nginx基本使用

作者: 程序员小华 | 来源:发表于2018-04-12 17:16 被阅读0次

启动、关闭、重启

./nginx      启动命令
./nginx -s stop   关闭命令
./nginx -s reload   重新加载配置nginx.conf文件,使用该命令可以在nginx.conf文件改动的时候不需要重新启动nginx即可生效

nginx.conf文件简单配置

#待选服务器列表
    upstream testHost{
        server 127.0.0.1:8080 weight=1;
        server 127.0.0.1:8081 weight=1;
    }

  server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        #
        location / {
            #选择哪个服务器列表
            proxy_pass http://testHost;
            #proxy_pass http://127.0.0.1:8082;
         }

        location /ceshi/ {
            proxy_pass http://127.0.0.1:8082/;
        }

        location /xixi/ {
            proxy_pass http://127.0.0.1:8083/;
        }

相关文章

网友评论

      本文标题:Nginx基本使用

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