簡單的centos 5.3 LEMP以及vsftpd配置

來源:互聯網
上載者:User

linux+nginx+mysql+php

免得以後忘

1.啟用EPEL,rpmforge的centos安裝源,rpm -i 兩個rpm包

2.安裝gcc等編譯工具yum install gcc …

3.安裝一堆標頭檔如yum install pcre-devel zlib-devel libiconv-devel mysql-devel libmcrypt-devel openssl-devel ..等等

4.直接yum個mysql用.暫時不用mysqli,夠了

5.轉到不影響系統工作的目錄,如cd ~

編譯nginx ->wget www.nginx.net網站的下載連結

./configure

中間缺什麼yum什麼 如缺mhash就yum install libmhash-devel

make&&make install

6.編譯php 先到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

開discuz論壇的話以上夠用

make&&make install

8.配置vsftpd

yum install vsftpd

配置vi /etc/vsftpd/vsftpd.conf

/anonymous_enable=

YES->NO

service vsftpd start

chkconfig vsftpd on

9.設定網站目錄

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

useradd -g ftp daminger.net

修改密碼passwd daminger.net

以後可以使用此賬戶ssh網站/ftp網站

10.配置nginx

編譯安裝,預設設定檔在/usr/local/nginx

vi conf/nginx.conf

第一行user改為apache

/server?? 搜尋

照著我的改改

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

關掉apache

11.設定nginx啟動指令碼

cd /etc/init.d

vi nginx

我的指令碼.修改自nginx官方

#!/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.設定php-fcgi
首先安spawn-cgi
yum install lighttpd-fastcgi
然後在/etc/init.d裡增加指令碼lighttpd

#!/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

運氣好的話網站就跑起來了

13.補充
所有指令碼必須增加執行許可權chmod 777 xxx
一般沒有yum不到的東西 利用yum search /list 以及goolge.com/ncr

完.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.