linux:nginx
This is an old revision of the document!
Table of Contents
Nginx Config
This page is used to record some notes when I config a VPS running with Nginx.
Create a new server block
cd /etc/nginx/ cd sites-available/ cp default team.pjq.me.conf vim team.pjq.me.conf
Then edit the config file
listen 80; root /var/www/team/; server_name team.pjq.me;
Then enable this site:
ln -s /etc/nginx/sites-available/team.pjq.me.conf /etc/nginx/sites-enabled/ /etc/init.d/nginx restart
So the site is running, cheers.
Enable directory list
Add “autoindex on;”
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
autoindex on;
}
Revert Proxy
server {
server_name wechat.pjq.me;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8080;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
}
Enable php
apt-get install php5-fpm /etc/init.d/php5-fpm restart
grep -v -E "#|^$" /etc/nginx/sites-available/ef.pjq.me.conf
server {
listen 80;
root /var/www/ef/;
index index.html index.htm;
server_name ef.pjq.me;
location / {
try_files $uri $uri/ =404;
autoindex on;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
/var/www/dokuwiki/wiki/data/attic/linux/nginx.1404964376.txt.gz · Last modified: 2016/05/05 13:06 (external edit)
