CentOS 6.7 / nginx / php5.4
#!/bin/bash
cd /usr/local/src
yum install -y wget telnet gcc-c++ vsftpd vim subversion subversion-devel
# epel repo
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# webtatic repo
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install -y zlib-devel nginx php54w php54w-cli php54w-common php54w-devel php54w-fpm php54w-gd php54w-mbstring php54w-mcrypt php54w-odbc php54w-pdo php54w-pear php54w-xml php54w-mysql libevent libevent-devel
# memcached 설치 및 세팅
yum install -y libpcre3-dev pcre-devel gcc make
yum install -y memcached memcached-devel libmemcached libmemcached-devel php54w-pecl-memcache
# apc
pecl install apc
pecl install svn
echo "extension=apc.so" > /etc/php.d/apc.ini
# permission
mkdir -p /game/public_html
mkdir -p /game/log
chmod 705 /game/public_html
chmod 707 /game/log
if [ ! -f /game/public_html/info.php ]
then
touch /game/public_html/info.php
echo "<?php phpinfo();" >> /game/public_html/info.php
fi
# log dir 소유자 변경
chown -R nginx.nginx /var/log/nginx
chown -R nginx.nginx /var/log/php-fpm
# 서비스 등록
chkconfig --level 345 nginx on
chkconfig --level 345 php-fpm on
chkconfig --level 345 memcached on
# server start
/etc/init.d/memcached restart
/etc/init.d/php-fpm restart
/etc/init.d/nginx restart
/etc/php-fpm.d/www.con
- ; Unix user/group of processes
- ; Note: The user is mandatory. If the group is not set, the default user's group
- ; will be used.
- ; RPM: apache Choosed to be able to access some dir as httpd
- user = nginx
- ; RPM: Keep a group allowed to write in log dir.
- group = nginx
/etc/nginx/conf.d/default.conf
1) Add the index.php to the index location
2) Change the root location to /usr/share/nginx/html
3) Uncomment the Pass PHP scripts to FastCGI section.
4) Change the fastcgi_param SCRIPT_FILENAME to use /usr/share/nginx/html$fastcgi_script_name
- #
- # The default server
- #
- server {
- listen 80 default_server;
- server_name _;
- #charset koi8-r;
- #access_log logs/host.access.log main;
- # Load configuration files for the default server block.
- include /etc/nginx/default.d/*.conf;
- location / {
- root /usr/share/nginx/html;
- index index.php index.html index.htm;
- }
- error_page 404 /404.html;
- location = /404.html {
- root /usr/share/nginx/html;
- }
- # redirect server error pages to the static page /50x.html
- #
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php$ {
- root /usr/share/nginx/html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
- include fastcgi_params;
- }
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- #location ~ /\.ht {
- # deny all;
- #}
- }
참고) https://www.atlantic.net/community/howto/install-lemp-centos-6/
'아카이브 > Linux' 카테고리의 다른 글
성능 정보 세 가지 (0) | 2016.06.27 |
---|---|
[vi설정] (0) | 2015.01.27 |
Ubuntu의 apt-get 명령어 정리 (0) | 2015.01.26 |
유용한 유닉스 명령어(퍼옴) (0) | 2015.01.22 |
리눅스 터미널에서 usb mount(usb 사용) (0) | 2015.01.16 |