Linux configuration Nginx+php+mysql Environment steps detailed

Source: Internet
Author: User
Tags fpm install php mysql download php and php download

1, the preparation of resources:

Nginx Download Address: http://nginx.org/download/nginx-1.3.14.zip

PHP Download Address: http://windows.php.net/downloads/releases/php-5.2.17-nts-Win32-VC6-x86.zip

MySQL Download Address: http://www.mysql.com/downloads/installer/

1, first uninstall the system from the Apache

The code is as follows Copy Code

Yum Remove httpd

2, install MySQL, set password, etc., you can refer to CENTOS6 installation MySQL and configure the import backup

The code is as follows Copy Code

Yum install MySQL Mysql-server

3, installation Nginx, if Yum installation

The code is as follows Copy Code

Yum Install Nginx

4, the installation of PHP and related modules

The code is as follows Copy Code
Yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcryp T php-mssql php-snmp Php-soap Php-tidy


#编辑文件php. ini, add cgi.fix_pathinfo = 1 at the end of the file
Vi/etc/php.ini

#启动php-FPM

The code is as follows Copy Code
Service PHP-FPM Start

Related nginx configuration file:

The code is as follows Copy Code

server {
Listen 80;
server_name localhost;

#access_log/var/nginx/logs/acccess-ebiz.log;

# Proxy The PHP scripts to Apache listening on 127.0.0.1:80

Location/{
Root/var/www/ecshop;
Index index.html index.htm index.php;
AutoIndex on;
}

# location ~ php$ {
# Proxy_pass http://127.0.0.1;
#}

# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

Location ~. php$ {
Root/var/www/ecshop;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}

#error_page 404/404.html;

# REDIRECT Server error pages to the static page/50x.html
#
#error_page 502 503 504/50x.html;
Location =/50x.html {
Root/var/www/nginx-default;
}

}

Finally create a new PHP file, add:

The code is as follows Copy Code

<?php
Phpinfo ();
?>

Date.timezone = asia/chongqing

Session.auto_start =1

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.