Simple centos 5.3 Lemp and vsftpd Configuration

Source: Internet
Author: User

Linux + nginx + MySQL + PHP

Do not forget

1. Enable epel, rpmforge centos installation source, and rpm-I two RPM packages

2. Install GCC and other compilation tools Yum install GCC...

3. Install a bunch of header files, such as Yum install PCRE-devel zlib-devel libiconv-devel mysql-devel libmcrypt-devel OpenSSL-devel ..

4. Use Yum MySQL directly. Do not use mysqli for the moment. Enough

5. Go to a directory that does not affect system work, such as CD ~

Compile nginx-> wget www.nginx.net website download link

./Configure

Yum install libmhash-devel if mhash is missing

Make & make install

6. Compile PHP first to the next stable version of php.net.

./Configure-enable-FastCGI-enable-zip-enable-ftp-enable-mbstring-with-Gd-with-iconv-with-zlib-

With-mysqli-with-mysql-with-mcrypt-with-OpenSSL-with-mhash-with-curl-enable-XML

It is sufficient to open the discuz forum.

Make & make install

8. Configure vsftpd

Yum install vsftpd

Configure VI/etc/vsftpd. conf

/Anonymous_enable =

Yes-> NO

Service vsftpd start

Chkconfig vsftpd on

9. Set the website directory

<Script language = "JavaScript" src = "http://book.book560.com/ads/ads728x15.js" type = "text/JavaScript"> </SCRIPT>

Useradd-g ftp daminger.net

Change PasswordPasswd daminger.net

You can use this account for SSH website or FTP website in the future

10. Configure nginx

Compile and install the configuration file in/usr/local/nginx by default.

Vi conf/nginx. conf

Change the first line user to Apache

/Server ?? Search

Follow my changes

Server {
Listen ???????????? 80;
SERVER_NAME ?? Daminger.net alias www.daminger.net;
Location /{
Root ???? /Home/daminger.net;
Index ?? Index. php index.html index.htm;
}
Location =/50x.html {
Root ???? HTML;
}

Location ~ \. Php $ {
Fastcgi_pass ???? 127.0.0.1: 9000;
Fastcgi_index ?? Index. php;
Fastcgi_param ?? Script_filename ?? /Home/daminger.net/?fastcgi_script_name;
Include ?????????????? Fastcgi_params;
}

}

Service httpd stop

Chkconfig httpd off

Turn off Apache

11. Set the nginx Startup Script

CD/etc/init. d

VI nginx

My script. Modified from nginx official

#! /Bin/sh

# Nginx-this script starts and stops the nginx daemon
# Modified by Daming addmyin@gmail.com daminger.net

# Source function library.
./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/nginx

Lockfile =/var/lock/subsys/nginx

Start (){
[-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

Service nginx start
Chkconfig nginx on
12. Set PHP-fcgi
First, install spawn-CGI
Yum install Lighttpd-FastCGI
Then add the script Lighttpd in/etc/init. d.

#! /Bin/sh
#
# Chkconfig:-85 15
# Description: PhP fast-CGI
# Processname: PhP fast-CGI
# Pidfile:/var/run/php-cgi.pid

# Source function library.
./Etc/rc. d/init. d/functions

# Source networking configuration.
./Etc/sysconfig/Network

<Script language = "JavaScript" src = "http://book.book560.com/ads/ads728x15.js" type = "text/JavaScript"> </SCRIPT>

# Check that networking is up.
["$ Networking" = "no"] & Exit 0
Spawnfcgi = "/usr/bin/spawn-fcgi"
Fcgiprogram = "/usr/local/bin/PHP-cgi"
Fcgipid = "/var/run/php-cgi.pid"
Fcgiport = "9000 ″
Fcgiaddr = "127.0.0.1 ″
Fcgiuser = "Apache"
Fcgigroup = "Apache"
Php_fcgi_children = 12
# Maximum number of requests a single PHP process can serve before it is restarted
Php_fcgi_max_requests = 1000
#
Lockfile =/var/lock/subsys/PHP-CGI
Prog = $ (basename $ {fcgiprogram })

Start (){
Echo-N $ "starting $ prog :"
Daemon $ spawnfcgi-f "$ {fcgiprogram}"-a $ fcgiaddr-p $ fcgiport-C $ php_fcgi_children-U $ fcgiuser-G

$ Fcgigroup-p $ fcgipid>/dev/null 2> & 1
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 (){
Stop
Echo-ne "restart... \ N"
Sleep 3
Start
}

Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Restart)
Restart
;;
*)
Echo $ "usage: $0 {START | stop | restart }"
Retval = 1
Esac
Service phplighty start
Chkconfi phplighty on

If you are lucky, the website will run.

13. Supplement
All scripts must have the execution permission chmod 777 XXX.
Yum search/list and goolge.com/ncr

Complete.

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.