首页 > 其他 > 详细

Nginx(1) - Beginner’s Guide

时间:2016-02-01 18:35:40      阅读:299      评论:0      收藏:0      [点我收藏+]

Starting, Stopping, and Reloading Configuration

nginx -s stop --fast shutdown
nginx -s quit --graceful shutdown
nginx -s reload --reloading the config file
nginx -s reopen --reopening the log files

kill -s QUIT 1628
ps -ax | grep nginx

Serving Static Content

/data/www --index.html
/data/images --some images

http {
    server {
        location / {
            root /data/www;
        }

        location /images/ {
            root /data;
        }
    }
}    

http://localhost/images/example.png -- /data/images/example.png
http://localhost/some/example.html -- /data/www/some/example.html

nginx -s reload

Find out reason in access.log or error.log, in the directory of /usr/local/nginx/logs or /var/log/nginx

Setting Up a Simple Proxy Server

http {
    server {
        location / {
            proxy_pass http://localhost:8080;
        }
        
        location ~ \.(gif|jpg|png)$ {
            root /data/images;
        }
    }
}

Setting Up FastCGI Proxying

http {
    server {
        location / {
            fastcgi_pass  localhost:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param QUERY_STRING    $query_string;
        }

        location ~ \.(gif|jpg|png)$ {
            root /data/images;
        }
    }
}

 

Nginx(1) - Beginner’s Guide

原文:http://www.cnblogs.com/thlzhf/p/5175531.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!