标签:
server { listen 80; server_name www.funsion.com; root /www/web/funsion; index index.php; location / { # 不带www的时候,自动加上www if ($host !~ ‘^www‘) { rewrite "^/(.*)$" http://www.$host/$1 permanent; } if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; # 自定义服务器环境变量 fastcgi_param DB_TYPE ‘mysql‘; fastcgi_param DB_HOST ‘127.0.0.1‘; fastcgi_param DB_NAME ‘funsion_db‘; fastcgi_param DB_USER ‘wfc‘; fastcgi_param DB_PWD ‘123456‘; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 1d; } location ~ ^(/ThinkPHP|/Application|/Runtime|/Db|/Addons|/.git)/ { # 防止核心文件被访问 return 404; } access_log /home/log/nginx/access/www.test.com.log; error_log /home/log/nginx/www.test.com.error.log; }
标签:
原文地址:http://www.cnblogs.com/funsion/p/5249363.html