文件是:/usr/local/nginx/conf/vhost/域名.conf
以下是1889.com跳转到www.1889.com
server {
listen 80;
server_name 1889.com;
rewrite ^/(.*)$ http://www.1889.com/$1 permanent;
}
server
{
listen 80;
server_name www.1889.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/www;
include none.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
/etc/init.d/nginx restart 重启生效
以下是1889.com跳转到www.1889.com
server {
listen 80;
server_name 1889.com;
rewrite ^/(.*)$ http://www.1889.com/$1 permanent;
}
server
{
listen 80;
server_name www.1889.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/www;
include none.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
/etc/init.d/nginx restart 重启生效