服务器 发布日期:2024/11/1 浏览次数:1
Yii的Nginx rewrite
如下为nginx yii的重写
server { set $host_path "/data/site/www.jb51.net"; access_log /data/logs/nginx/www.jb51.net_access.log main; server_name jb51.net www.jb51.net; root $host_path/htdocs; set $yii_bootstrap "index.php"; # define charset charset utf-8; location / { index index.html $yii_bootstrap; try_files $uri $uri/ /$yii_bootstrap"htmlcode">server { listen 80; server_name www.jb51.net; root /data/site/www.jb51.net; index index.php; access_log /data/logs/nginx/www.jb51.net_accerss.log; error_log /data/logs/nginx/www.jb51.net_error.log; # main cakephp rewrite rule location / { try_files $uri $uri/ /index.php?$uri&$args; } location ~ .php$ { root /data/site/www.jb51.net; try_files $uri =404; fastcgi_pass unix:/tmp/php5-fpm.sock; # 改成你对应的FastCGI fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } }重启nginx即可