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;
}
}
}