|
- server
- {
- listen 80;
- server_name www.loc16.com loc16.com;
- server {
- server_name www.loc16.com loc16.com;
- rewrite ^/(.*) http://www.loc16.com/$1 permanent;
- }
- index index.html index.htm index.php default.html default.htm default.php;
- root /data/loc16.com;
- include none.conf;
- location ~ .*\.(php|php5)?$
- {
- try_files $uri =404;
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 12h;
- }
- access_log off;
- }
- ~
复制代码 想把loc16.com www.loc16.com 重定向成 http://www.loc16.com
用上面的命令是成功了。但是重启lnmp的时候有错误。 怎么样才不出错误。
Reload LNMP...
Reload Nginx configure...
nginx: [emerg] "server" directive is not allowed here in /usr/local/nginx/conf/vhost/www.loc16.com.conf:6
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
nginx: [emerg] "server" directive is not allowed here in /usr/local/nginx/conf/vhost/www.loc16.com.conf:6
Nginx program is reloding!
SUCCESS! Reloading service MySQL
Reload service php-fpm done
|
|