服务器 
首页 > 服务器 > 浏览文章

PHP的Symfony和CodeIgniter框架的Nginx重写规则配置

(编辑:jimmy 日期: 2025/3/6 浏览:3 次 )

Symfony
Symfony国外很流行的php框架,目前国内用的相对较少,但是一定会在国内火起来. nginx重写规则如下

server {
 server_name jb51.net www.jb51.net;
 root /data/site/www.jb51.net;
location / {
 # try to serve file directly, fallback to rewrite
 try_files $uri @rewriteapp;
 }
location @rewriteapp {
 # rewrite all to app.php
 rewrite ^(.*)$ /app.php/$1 last;
 }
location ~ ^/(app|app_dev|config).php(/|$) {
 fastcgi_pass unix:/var/run/php5-fpm.sock; # 改成你对应的FastCGI
 fastcgi_split_path_info ^(.+.php)(/.*)$;
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_param HTTPS off;
 }
error_log /data/logs/nginx/www.jb51.net_error.log;
 }

 
重启nginx即可

CodeIgniter
CodeIgniter,即被很多人简称为CI的高人气PHP框架,其中文社区也比较活跃,来看一下CI的rewrite写法:

server {
 listen 80;
 server_name jb51.net www.jb51.net;
root /data/site/www.jb51.net;
 index index.php;
 error_log log/error.log;
# set expiration of assets to MAX for caching
 location ~* .(ico|css|js|gif|jpe"htmlcode">
$config['base_url'] = "https://www.jb51.net/";
 $config['index_page'] = "";
 $config['uri_protocol'] = "REQUEST_URI";

上一篇:windows 7架设OpenSSH服务器实践
下一篇:Nginx配合Apache或Tomcat的动静分离基本配置实例
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 站点导航 SiteMap