CentOS 6.5 Installation Configuration Lnmp server (nginx+php+mysql)

Source: Internet
Author: User
Tags fpm install php openssl

CentOS 6.5 Installation Configuration Lnmp server (nginx+php+mysql)
I. Preparation of the article:

1/etc/init.d/iptables stop#shutting down the firewall2 Turn off SELinux3vi/etc/selinux/Config4 #selinux=enforcing #注释掉5 #selinuxtype=targeted #注释掉6Selinux=disabled#Increase7 : Wq8Shutdown-r now#Rebooting the system

Two. Installation Chapter

1. Installing Nginx

1Yum Remove httpd* php*#Remove the package that comes with your system2 Installation steps:3 because Nginx modules require support from third-party libraries, the following libraries need to be installed.4 installing the GCC compiler and related tools5 #yum-y Install gcc gcc-c++ autoconf automake make6 to install dependent modules7 #yum-y install zlib zlib-devel OpenSSL openssl-devel pcre pcre-devel8 To create an nginx system account:9 because Nginx is a system service, running this service requires a system account. Ten #Groupadd Nginx One #Useradd-r-G nginx-s/sbin/nologin-m Nginx ASoftware source Package storage location:/opt/ - #cd/opt/ - #TAR-ZXVF Nginx-1.2.4.tar the #CD nginx-1.2.4 - #./configure--prefix=/usr/local/nginx--user=www--group=www--with-http_stub_status_module//install by compiling the source code 
     - # Make - #Make Install + start Nginx - #start Nginx + #/usr/local/nginx/sbin/nginx-t A The following information is displayed for the correct at  -The configuration file/usr/local/nginx/conf/nginx.conf syntax isOK configuration file/usr/local/nginx/conf/nginx.conf Test issuccessful - #/usr/local/nginx/sbin/nginx

After successful startup, view Nginx process information: # PS-EF | grep Nginx, see if there is an nginx process to confirm the successful start.

2. Install MySQL (you can also use the system to bring your own MySQL)

1. Install MySQL

1Yum install MySQL Mysql-server#Enter Y to install automatically until the installation is complete2/etc/init.d/mysqld start#start MySQL3 4Chkconfig mysqld on#set to boot5 6Cp/usr/share/mysql/my-medium.cnf/etc/my.cnf#Copy the configuration file (Note: if the/etc directory has a default MY.CNF, you can overwrite it directly)7 set a password for the root account8 9 mysql_secure_installationTen  One #Enter , according to the prompt input y, enter 2 times password, return, according to the prompt input Y, and finally appear: Thanks for using mysql! A  - mysql Password setup is complete, restart MySQL: -  the/etc/init.d/mysqld restart# Restart -  -/etc/init.d/mysqld stop#Stop -  +/etc/init.d/mysqld start#Start

3, Installation PHP5

1, installation PHP5

1Yum Install PHP php-fpm#Enter Y as prompted until the installation is complete2 32, install PHP components, enable PHP5 to support MySQL4 5Yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php- Bcmath php-Mhash Libmcrypt6 7 #Select the above installation package here to install, as prompted to enter Y return8 9Chkconfig PHP-FPM on#set php-fpm boot upTen  One/ETC/INIT.D/PHP-FPM start#Start PHP-FPM

Configuration Chapter

First, the configuration Nginx support PHP

1Cp/usr/local/nginx/conf/nginx.conf/usr/local/nginx/conf/nginx.confbak#back up the original configuration file2vim/usr/local/nginx/conf/nginx.conf3User www;#Modify Nginx running account as: www user4: Wq#Save Exit5vim/usr/local/nginx/conf/nginx.conf6 7Index index.php index.html index.htm;#Increase index.php8 9 #Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000Ten # OneLocation ~\.php$ { A root html; -Fastcgi_pass 127.0.0.1:9000; - Fastcgi_index index.php; the Fastcgi_param script_filename $document _root$fastcgi_script_name; - include Fastcgi_params; - } -  + #Uncomment the fastcgi Server section location, and note the parameters of the Fastcgi_param row, change to $document_root$fastcgi_script_name, or use the absolute path -Service Nginx Restart#re-start Nginx

Second, PHP configuration

1vi/etc/php.ini2 3Date.timezone = PRC#in line 946, remove the preceding semicolon and change to Date.timezone = PRC4 5Disable_functions =6 7PassThruexec, SYSTEM,CHROOT,SCANDIR,CHGRP,CHOWN,SHELL_EXEC,PROC_OPEN,PROC_GET_STATUS,INI_ALTER,INI_ALTER,INI_RESTORE,DL , Ope8 9 Nlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space, Checkdnsrr,checkdnsTen  One RR,GETSERVBYNAME,GETSERVBYPORT,DISK_TOTAL_SPACE,POSIX_CTERMID,POSIX_GET_LAST_ERROR,POSIX_GETCWD, A  - Posix_getegid,posix_geteuid,posix_getgid, -  the Posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,  -  - Posix_getppid,posix_getpwnam,posix_getpwuid, Posix_getrlimit, Posix_getsid,posix_getuid,posix_isatty, -  + Posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, - Posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname + #in the 386 row out of PHP can disable the function, if some programs need to use this function, can be deleted, cancel disable.  AFound: Date.timezone = atModified to: Date.timezone = PRC#Setting the time zone -Found: expose_php = on -Modified to: expose_php = OFF#suppress the display of PHP version information -Found: Short_open_tag =Off -Modified to: Short_open_tag = On#PHP short Tag support -: wq!#Save Exit

Test article

1cd/usr/local/nginx/HTML2 3Vim index.php#Add the following code4 5CentOS <wbr>6.5 Installation Configuration Lnmp server (nginx+php+MySQL)6 : wq!7 8Chown Www.www/usr/local/nginx/html-R#Set Permissions9 TenService Nginx Restart#re-start Nginx One  AService PHP-FPM Restart#Restart php-fpm

In the client browser enter the server IP address, you can see the relevant configuration information!

Description LNMP Configuration succeeded!
At this point, the CnetOS6.4 installation configuration Lnmp (nginx+php+mysql) configuration is complete.

CentOS 6.5 Installation Configuration Lnmp server (nginx+php+mysql)

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.