新聞中心
本文實例講述了Centos7系統(tǒng)nginx服務器下phalcon環(huán)境搭建方法。分享給大家供大家參考,具體如下:

麗江網(wǎng)站建設公司創(chuàng)新互聯(lián),麗江網(wǎng)站設計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為麗江超過千家提供企業(yè)網(wǎng)站建設服務。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設要多少錢,請找那個售后服務好的麗江做網(wǎng)站的公司定做!
之前我們采用的是Apache服務器,可是每秒響應只能達到2000,聽說nginx可以輕易破萬,
于是換成nginx試試。
phalcon的官網(wǎng)有nginx重寫規(guī)則的示例,可是卻與apache的不一致,被坑了好久。
1、添加nginx源
vi /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
2、修改nginx的配置
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost.dev;
index index.php index.html index.htm;
root /var/www/html;
location / {
root /var/www/html; #phalcon官網(wǎng)上是public目錄,如果用這個目錄就和apache的配置不一樣了
index index.php index.html index.htm;
# 如果文件存在就直接返回這個文件
if (-f $request_filename) {
break;
}
# 如果不存在就重定向到public/index.php
if (!-e $request_filename) {
rewrite ^(.+)$ /public/index.php?_url=$1 last;
break;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root /var/www/html/public;
}
location ~ /\.ht {
deny all;
}
}
3、php-fpm的配置
vi /etc/php-fpm.d/www.conf
修改為用戶和用戶組
; RPM: apache Choosed to be able to access some dir as httpd user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx
4、用戶組修改
chown -R nginx:nginx /var/lib/php/session/ chown -R nginx:nginx /var/www/html/
重啟nginx、php-fpm,
systemctl restart nginx systemctl restart php-fpm
進一步的優(yōu)化且待之后的情況
希望本文所述對大家centos服務器操作有所幫助。
成都創(chuàng)新互聯(lián)建站主營:成都網(wǎng)站建設、網(wǎng)站維護、網(wǎng)站改版的網(wǎng)站建設公司,提供成都網(wǎng)站制作、成都網(wǎng)站建設、成都網(wǎng)站推廣、成都網(wǎng)站優(yōu)化seo、響應式移動網(wǎng)站開發(fā)制作等網(wǎng)站服務。
本文題目:centos7系統(tǒng)nginx服務器下phalcon環(huán)境搭建方法詳解
URL分享:http://www.5511xx.com/article/coijigo.html


咨詢
建站咨詢
