Yum builds lnmp environment (centos6.4)

Source: Internet
Author: User

1. Disable Firewall
[Root @ centos ~] # Chkconfig iptables off

2. Disable SELinux
VI/etc/sysconfig/SELinux
// Change SELinux = enforcing to disabled and then restart the instance to take effect.

3. Configure the third-party Yum source of centos 6.0 (the nginx package is not included in the standard source of centos by default)
[Root @ centos ~] # Yum install wget
// Download the wget Tool
[Root @ centos ~] # Wget http://www.atomicorp.com/installers/atomic
// Download the atomic Yum Source
[Root @ centos ~] # Sh./Atomic
// Enter yes when prompted for Installation
[Root @ centos ~] # Yum check-Update
// Update the yum Software Package

4. Install the development kit and library files
[Root @ centos ~] # Yum-y install NTP make OpenSSL-devel PCRE-devel libpng
Libpng-devel libjpeg-6b libjpeg-devel-6b FreeType-devel Gd-devel zlib-devel
GCC gcc-C ++ libxpm-devel ncurses-devel libmcrypt-devel libxml2
Libxml2-devel imake Autoconf automake screen sysstat compat-libstdc ++-33 curl-devel

5. Uninstall installed Apache, MySQL, and PHP
[Root @ centos ~] # Yum remove httpd
[Root @ centos ~] # Yum remove MySQL
[Root @ centos ~] # Yum Remove PHP

6. Install nginx
[Root @ centos ~] # Yum install nginx
[Root @ centos ~] # Service nginx start
[Root @ centos ~] # Chkconfig -- levels 235 nginx on
// Set 2, 3, and 5 levels for startup

7. Install MySQL
[Root @ centos ~] # Yum install MySQL mysql-server mysql-devel
[Root @ centos ~] # Service mysqld start
[Root @ centos ~] # Chkconfig -- levels 235 mysqld on
[Root @ centos ~] # Mysqladmin-u Root Password "123456"
// Set the password for the root user
[Root @ centos ~] # Service mysqld restart
// Restart MySQL

8. install PHP
[Root @ centos ~] # Yum install PHP Lighttpd-FastCGI PHP-cli PHP-mysql PHP-Gd PHP-imap PHP-LDAP
Php-odbc PHP-pear PHP-xml php-xmlrpc php-mbstring PHP-mcrypt PHP-mssql php-snmp php-soap
Php-tidy PHP-common PHP-devel PHP-FPM
// Install PHP and required components so that PHP supports MySQL and FastCGI Modes
[Root @ centos ~] # Service PHP-FPM start
[Root @ centos ~] # Chkconfig -- levels 235 PHP-FPM on

9. Configure nginx to support PHP
[Root @ centos ~] # Mv/etc/nginx. CONF/etc/nginx. confbak
// Change the configuration file to a backup file
[Root @ centos ~] # Cp/etc/nginx. conf. Default/etc/nginx. conf
// Because the original configuration file needs to be written by yourself, you can use the default configuration file as the configuration file
// Modify the nginx configuration file and add FastCGI support
[Root @ centos ~] # Vi/etc/nginx. conf
Index index. php index.html index.htm;
// Add index. php
Location ~ \. Php $ {
Root/usr/share/nginx/html;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param script_filename/usr/share/nginx/html $ fastcgi_script_name;
Include fastcgi_params;
}
// Replace the aboveCodeRemove the annotation and change it to the nginx default path.

10. Configure PHP
// Edit the php. ini file and add CGI. fix_pathinfo = 1 at the end of the file.
[Root @ centos ~] # Vi/etc/PHP. ini

11. Restart nginx PHP-FPM
[Root @ centos ~] # Service nginx restart
[Root @ centos ~] # Service PHP-FPM restart

12. Create the info. php file.
[Root @ centos ~] # Vi/usr/share/nginx/html/info. php
<? PHP
Phpinfo ();
?>

13. Test whether nginx parses PHP
Input: 192.168.1.105/info. php
The PHP interface is displayed, indicating that the resolution is successful.

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.