Deploy Nginx + PHP5 server in CentOS 6 and centosng.pdf

Source: Internet
Author: User
Tags nginx server

Deploy Nginx + PHP5 server in CentOS 6 and centosng.pdf
Deploy Nginx + PHP5 Web server in CentOS 6

InCetnOS 6 (64-bit)Deploy Nginx and PHP5 servers on the operating system. This process passesYumCommand to install the RPM package.

Refer to the official PHP documentation.

Install necessary YUM Libraries

RootUser execution:

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install Nginx

AddNginxYUM library configuration file/Etc/yum. repos. d/nginx. repo,

[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1

RootUser execution:

# yum install nginx
Install PHP and important plug-ins php-fpm

RootUser execution:

# yum install php-fpm php
Configure and start php-fpm

Configuration/Etc/php. ini:

# Locate and cancel the annotation and set it to cgi. fix_pathinfo = 0.

Configuration// Etc/php-fpm.d/www. conf:

# Locate and cancel the annotation and set it to the user you want to manage the www application (I will use the user theflash here) listen. owner = theflashlisten. group = theflash

Start the php-fpm listening service

# service php-fpm start

Stop the php-fpm listening service

# service php-fpm stop
Configure and start Nginx

Create a website root directory/Data/wwwrootAnd change the directory ownerTheflash.
RootUser execution

# mkdir -p /data/wwwroot# chown theflash:theflash /data/wwwroot -R

From then on, users will be used in the futureTheflashTo log on and maintain/Data/wwwrootData in

Share my configurations directly/Etc/nginx. conf:

user theflash;events {}http {    include     /etc/nginx/mime.types;    server {        root    /data/wwwroot;        location / {            index   index.html index.htm index.php;        }        error_page  404              /404.html;        location ~* \.php$ {            fastcgi_index   index.php;            fastcgi_pass    127.0.0.1:9000;            fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;            include         fastcgi_params;        }    }}

Start Nginx Server

# service nginx start

Stop Nginx Server

# service nginx stop

If the configuration file is modified during running, you need to reload the Nginx server configuration file.No need to stopNginx Server

# nginx -s reload
FAQ how to solve the "no input file specified" problem, when we install PHP and NGINX

Article: original English version

Check if php files haveWrite PermissionIts parent directory hasExecution permission?

#<-- container folders should be granted execute permissionchmod a+x /datachmod a+x /data/wwwroot

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.