nginx如何设置访问路径

vim nginx.conf

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    
    #upstream myserver {                 #这里是设置负载均衡的地方!
        #server 192.168.23.110:8080;
        #server 192.168.23.110:8081;
    #}

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;
       
        location / {
            root   html;  #这里是你设置访问的路径,例如:/home/test/
            #root   /home/test;
            index  index.html index.htm;
            #proxy_pass http://myserver;  #这里是上面设置负载均衡跳转的地方

        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}


你可能感兴趣的:(nginx,服务器,运维)