7-13 910 views
安装Nginx
sudo apt-get install nginx
启动Nginx
sudo /etc/init.d/nginx restart
配置文件
/etc/nginx/
启用配置文件
ln -s /etc/nginx/sites-available/fly3w /etc/nginx/sites-enabled/fly3w
支持PHP
sudo apt-get install php5-fpm
vim /etc/php5/fpm/pool.d/www.conf
修改 listen
#listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:9527
启动 php5-fpm
/etc/init.d/php5-fpm restart
添加站点
server {
listen 80;
server_name fly3w.com www.fly3w.com
access_log logs/www.fly3w.com.log main;
root /var/www/www.fly3w.com;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9527;
fastcgi_index index.php;
include fastcgi_params;
}
}
启用代理
server {
listen 80;
server_name restful.cc www.restful.cc
access_log logs/www.restful.cc.log main;
location / {
proxy_pass http://127.0.0.1:8888;
}
}
WordPress Rewrite
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
fastcgi_pass 127.0.0.1:9527;
fastcgi_index index.php;
include fastcgi_params;
}