centos7系統(tǒng)nginx服務(wù)器下phalcon環(huán)境搭建方法詳解
本文實(shí)例講述了centos7系統(tǒng)nginx服務(wù)器下phalcon環(huán)境搭建方法。分享給大家供大家參考,具體如下:
之前我們采用的是Apache服務(wù)器,可是每秒響應(yīng)只能達(dá)到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
進(jìn)一步的優(yōu)化且待之后的情況
希望本文所述對大家centos服務(wù)器操作有所幫助。
- CentOS8.1搭建Gitlab服務(wù)器詳細(xì)教程
- Centos8搭建本地Web服務(wù)器的實(shí)現(xiàn)步驟
- 在centos7上搭建mysql主從服務(wù)器的方法(圖文教程)
- 詳解基于centos7搭建Nginx網(wǎng)站服務(wù)器(包含虛擬web主機(jī)的配置)
- centos7.2搭建nginx的web服務(wù)器部署uniapp項(xiàng)目
- Centos7搭建主從DNS服務(wù)器的教程
- 在CentOS上安裝搭建PHP+Apache+Mysql的服務(wù)器環(huán)境
- CentOS搭建PHP服務(wù)器環(huán)境簡明教程
- Centos搭建chrony時間同步服務(wù)器過程圖解
相關(guān)文章
Ubuntu基礎(chǔ)教程之a(chǎn)pt-get命令
這篇文章主要給大家介紹了關(guān)于Ubuntu基礎(chǔ)教程之a(chǎn)pt-get命令的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用Ubuntu系統(tǒng)具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08linux .htaccess 設(shè)置 404 等錯誤頁面
linux服務(wù)器下通過設(shè)置htaccess來實(shí)現(xiàn)404轉(zhuǎn)向的代碼2008-06-06Apache 的 order deny allow 設(shè)置說明
Allow和Deny可以用于apache的conf文件或者.htaccess文件中(配合Directory, Location, Files等),用來控制目錄和文件的訪問授權(quán)。2010-12-12在Linux系統(tǒng)上安裝Spring boot應(yīng)用的教程詳解
這篇文章主要介紹了在Linux系統(tǒng)上安裝Spring boot應(yīng)用,本文通過實(shí)例文字相結(jié)合的形式給大家介紹的非常詳細(xì),具有一定的參考借鑒價值 ,需要的朋友可以參考下2019-05-05Linux使用suid vim.basic文件實(shí)現(xiàn)提權(quán)
這篇文章主要介紹了Linux使用suid vim.basic文件實(shí)現(xiàn)提權(quán),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-07-07