[Done] Nginx Admin
[ Service Control ]
/etc/init.d/nginx [start|stop|status|restart] : to start/stop/get_status/restart the nginx service.
nginx -s [stop|quit|reload|reopen] : to stop / gracefully_stop / reload_config / reopen_log_files.
/var/run/nginx.pid : the pid of the nginx master process.
[ Config File ]
/etc/nginx# cat nginx.conf
pid /var/run/nginx.pid; # pid of the nginx master process
worker_processes auto; # the amount of nginx worker processes
user nginx; #uid of nginx worker processes error_log /var/log/nginx/error.log crit; # error log.
events { # to control http connections worker_connections 1024; # max http connections that a worker process can manage. } http { include /etc/nginx/mime.types; default_type application/octet-stream;
access_log off; # turn off the access log.
    sendfile        on;  # use linux sendfile function
    #tcp_nopush     on;
    keepalive_timeout  65;  # for http keep alive feature
    #gzip  on;
    include /etc/nginx/conf.d/*.conf;
}
Sample-1: /etc/nginx/conf.d# cat default.conf server { listen 80; # set the ip and port of the web site # server_name localhost;
# customize error pages
# error_page 404 500 502 503 504 /error.html;
location / { # location selection root /usr/share/nginx/html; index index.html index.htm; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} }
Sample-2: /etc/nginx/sites-enabled# cat default 
upstream www_test {
        least_conn;
        server app.ali.lecomm.net:80;
        server db.ali.lecomm.net:80;
}
server {
        listen   80;
        location / {
                proxy_pass http://www.ali.lecomm.net:15117;
        }
}
server {
        listen  81;
        location / {
                proxy_pass http://www_test;
        }
}
server {
        listen  82;
        location / {   
                root   /var/www/portal;
                index  index.html index.htm;
        }
}
                    
                
                
            
        
浙公网安备 33010602011771号