1.
vim nginx.conf
如下:
server {
listen 80;
server_name pma;
index index.php;
root /home/XXXXX;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
}
server
{
listen 80;
server_name pmb;
index index.php;
root /home/wwwroot/default;
#location ~ .*\.(php|php5)?$
# {
# try_files $uri =404;
# fastcgi_pass unix:/tmp/php-cgi.sock;
# fastcgi_index index.php;
# include fcgi.conf;
# }
#location /status {
# stub_status on;
# access_log off;
#}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
#if (-f $request_filename) {
# break;
#}
rewrite "^/work/(.*)$" /work/index.php/$1 last;
………………………………………………………………
2.
vim /etc/hosts
添加下面:
127.0.0.1 pma
127.0.0.1 pmb
3. /etc/init.d/nginx restart
这样就可以通过http://pmb/XXX/XXX/XXX来访问了。