Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of the method of building phalcon environment under nginx server of centos7 system

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article describes the example of centos7 system nginx server under the phalcon environment building method. Share it for your reference, as follows:

Before we used Apache server, but the response per second can only reach 2000, I heard that nginx can easily break ten thousand,

Try Nginx instead.

The official website of phalcon has an example of nginx rewriting rules, but it is inconsistent with apache and has been pit for a long time.

1. Add nginx source

vi /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1

2, Modify nginx configuration

vi /etc/nginx/conf.d/default.confserver { listen 80; server_name localhost.dev; index index.php index.html index.htm; root /var/www/html; location / { root /var/www/html; #phalcon Official website is a public directory, if you use this directory and apache configuration is different index index.php index.html index.htm; #If the file exists, return it directly if (-f $request_filename) { break; } #redirect to public/index.php if it doesn't exist 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. Configuration of php-fpm

vi /etc/php-fpm.d/www.conf

Modify to Users and User Groups

; RPM: apache Choosed to be able to access some dir as httpduser = nginx; RPM: Keep a group allowed to write in log dir.group = nginx

4. User group modification

chown -R nginx:nginx /var/lib/php/session/chown -R nginx:nginx /var/www/html/

Restart nginx, php-fpm,

systemctl restart nginxsystemctl restart php-fpm

Further optimization and to be followed

I hope this article is helpful to all centos server operations.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report