CentOS6系统上Yii/Yii2/Nginx/PHP-FPM配置实例
2015-03-16 21:28
519 查看
Yii应用Apache的配置比较简单,nginx的配置主要需要处理单一入口文件的问题,也就是对应于Apache配置中的如下几句:
by iefreer
# if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.php RewriteRule . index.php需要翻译为相应的Nginx指令。实例示范如下:
server { listen 80; server_name www.techbrood.com; access_log logs/techbrood.access.log; root /var/www/html/techbrood/web; location / { index index.php; if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } } location ~ \.php(?|$) { #fastcgi(php-fpm) listening on 127.0.0.1:9000 root /var/www/html/techbrood/web; #your path to fastcgi_params file include /etc/nginx/conf/fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix: /var/run/php-fpm.sock } location ~ \.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { root /var/www/html/techbrood/web; } }
by iefreer
相关文章推荐
- CentOS 7系统LAMP配置PHP-FPM的示例
- Linux系统配置多实例php-fpm服务
- nginx 及 php-fpm和系统ulimit 配置优化&cpu信息查看
- 详解 CentOS 安装配置 Nginx 0.8.33+PHP 5.3.1+php-fpm+MySQL 全过程【转】
- Nginx+mysql+php-fpm负载均衡配置实例
- CentOS 7系统之 lamp (php-fpm)详解
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- CentOS6.4安装配置nginx+pcre+php/fpm
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- centos 配置nginx php-fpm mysql 环境步骤
- CentOS 7.0系统安装配置LAMP服务器(Apache+PHP+MariaDB)
- 阿里云Centos系统 配置php环境
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- Linux配置Nginx,MySql,php-fpm开机启动的方法 (centos)
- CentOS 6.X 配置Nginx支持php-fpm模块
- centOS5.6 下的nginx+mysql+php+php-fpm安装与配置
- CentOS6.3添加nginx php-fpm系统服务详细说明
- linux(centos)上配置nginx、mysql、php-fpm开机启动
- 阿里云CENTOS系统安装PHP+MYSQL+NGINX环境配置
- CentOS下yum安装PHP,配置php-fpm服务