uname -a
Linux h.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/redhat-release
CentOS release 6.3 (Final)
rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora//epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum --enablerepo=remi,remi-test install nginx
yum --enablerepo=remi,remi-test install php php-fpm php-common
yum --enablerepo=remi,remi-test install php-pecl-apc php-cli php-pear php-pdo php-mysql php
nginx -V
nginx version: nginx/1.2.6
built by gcc 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module \
--with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module \
--with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g'
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
location / {
root /home/WEB/;
index index.html index.htmi index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/WEB$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/WEB/;
}
}
vi /home/WEB/index.php
<?php phpinfo(); ?>
/etc/rc.d/init.d/php-fpm restart
/etc/rc.d/init.d/nginx restart
## check status
[root@hobbittw conf.d]# netstat -anpl | grep -E '9000|80'
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 32119/php-fpm
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 32173/nginx
unix 2 [ ACC ] STREAM LISTENING 9080 1215/master private/scache
unix 3 [ ] STREAM CONNECTED 9000 1215/master
張貼留言