Ins sys:
1.next all, then reboot.
2.login system use root
Cfg sys:
1.keep etc0 work:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
change:
ONBOOT=yes
then enable eth0:
# ifup eth0
-------------------------------------------------------------------------------------------
Ins npm:
1.use Xshell connect vmOS:
2.ins wget:
# yum install wget -y
3.mkdir:
# mkdir /home/upload
# cd /home/upload
4.ins gcc:
# yum install gcc -y
5.create serv Group & users:
# groupadd www
# useradd -M www nginx
6.ins nginx:
# yum install pcre-devel zlib-devel -y
# tar zxvf nginx-1.6.0.tar.gz
# cd nginx-1.6.0
# ./configure --prefix=/usr/local/nginx --user=nginx --group=www --with-pcre
# make
# make install
onboot:
# chkconfig nginx on
7.ins php:
# cd /home/upload
# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.6.tar.gz
# tar zvxf libmcrypt-2.5.6.tar.gz
# cd libmcrypt-2.5.6
# make
# make install
# cd ..
# yum install libxml2-devel -y
# tar zxvf php-5.5.13.tar.gz
# cd php-5.5.13
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql --with-mysqli --with-pdo-mysql --enable-opcache --enable-mbstring --enable-mbregex --with-mcrypt=/usr/local/libmcrypt --with-mhash --enable-cgi --enable-fpm
# make
# make install
# cp php.ini-development /usr/local/php/php.ini
# cd /usr/local/php/etc
# cp php-fpm.conf.default php-fpm.conf
# chkconfig php-fpm on
8.ins mysql:
# yum install mysql mysql-server mysql-devel -y
-------------------------------------------------------------------------------------------
Cfg server:
1.nginx:
# cd /usr/local/nginx/conf
# cp nginx.conf nginx.conf.bak
# vi nginx.conf
edit:
server -> location / -> index : add index.php
remove the comment & edit:
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 改为
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
2.php:
# vi /usr/local/php/php.ini
remove the comment & edit value: date.timezone = PRC
3.firewall open port:
# vi /etc/sysconfig/iptables
add 2 item:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
# /etc/init.d/iptables restart
3.npm noboot:
# vi /etc/rc.local
add 2 item:
‘
/usr/local/php/sbin/php-fpm
/usr/local/nginx/sbin/nginx
‘
# chkconfig mysqld on
-------------------------------------------------------------------------------------------
Test:
# cd /usr/local/nginx/html
# echo ‘<?php echo phpinfo(); ?>‘ > test.php
# service mysqld start
# /usr/local/php/sbin/php-fpm
# /usr/local/nginx/sbin/nginx
view:
http:192.168.56.1/test.php
Notice:
if
linux work envionrment is in vm
and
net connect method is nat:
must redirect local port
原文:http://www.cnblogs.com/tkaven/p/3811573.html