Install nginx PHP MySql in centos

Source: Internet
Author: User
Tags php mysql

Yum install mysql-Server
Yum install mysql-y
Wget http://nginx.org/download/nginx-1.5.1.tar.gz
Tar-xzf nginx-1.5.1.tar.gz
CD nginx-1.5.1
Um-y install PCRE-devel zlib-devel md5-devel OpenSSL
./Configure; Make; make install;
Yum-y install PHP
Yum-y install PHP-MySQL
Yum-y install PHP-Gd
Yum-y install memcached
Yum install-y PHP-FPM
Chkconfig PHP-FPM on
Chkconfig memcached on
Service memcached start

VI/etc/init. d/nginx

#! /Bin/bash. /etc/rc. d/init. d/functions # source networking configuration .. /etc/sysconfig/Network # Check that networking is up. ["$ networking" = "no"] & Exit 0 nginx = "/usr/local/nginx/sbin/nginx" prog =$ (basename $ nginx) nginx_conf_file = "/usr/local/nginx/CONF/nginx. conf "[-F/etc/sysconfig/nginx] &. /etc/sysconfig/nginxlockfile =/var/lock/subsys/nginxstart () {[-x $ nginx] | Exit 5 [-F $ nginx_conf _ File] | exit 6 echo-N $ "Starting $ prog:" daemon $ nginx-C $ nginx_conf_file retval =$? Echo [$ retval-EQ 0] & touch $ lockfile return $ retval} STOP () {echo-N $ "Stopping $ prog:" killproc $ prog-Quit retval =$? Echo [$ retval-EQ 0] & Rm-F $ lockfile return $ retval} restart () {configtest | return $? Stop sleep 1 start} reload () {configtest | return $? Echo-N $ "reloading $ prog:" killproc $ nginx-hup retval =$? Echo} force_reload () {restart} configtest () {$ nginx-T-C $ nginx_conf_file} rh_status () {Status $ prog} rh_status_q () {rh_status>/dev/null 2> & 1} case "$1" in START) rh_status_q & Exit 0 $1; stop) rh_status_q | exit 0 $1 ;; restart | configtest) $1; RELOAD) rh_status_q | exit 7 $1; force-Reload) force_reload; Status) rh_status; condrestart | try-Restart) rh_status_q | exit 0; *) echo $ "Usage: $0 {START | stop | status | restart | condrestart | try-Restart | reload | force-Reload | configtest} "Exit 2 esac

Chmod A + x/etc/init. d/nginx

VI/usr/local/nginx/CONF/nginx. conf

 
Location ~ \. Php $ {root/opt/WWW; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param script_filename/opt/WWW $ fastcgi_script_name; Include fastcgi_params ;}

Gzip on;
Gzip_types text/plain application/X-JavaScript text/CSS text/JavaScript Application/X-httpd-PHP image/JPEG image/GIF image/PNG application/X-Shockwave-flash;

Chkconfig nginx on
Service mysqld start
Service nginx restart
Service PHP-FPM start

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.