标签:des style http color os io strong for
su
## Remi Dependency on CentOS 7 and Red Hat (RHEL) 7 ## rpm -Uvh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm ## CentOS 7 and Red Hat (RHEL) 7 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm ## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ## rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm ## CentOS 6 and Red Hat (RHEL) 6 ##rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm ## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ## rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm ## CentOS 5 and Red Hat (RHEL) 5 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Create file /etc/yum.repos.d/nginx.repo and add following content to repo file:
CentOS
[nginx] name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
yum --enablerepo=remi,remi-php55 install nginx php-fpm php-common
OPcache (php-opcache) – The Zend OPcache provides faster PHP execution through opcode caching and optimization.
APCu (php-pecl-apc) – APCu userland caching
CLI (php-cli) – Command-line interface for PHP
PEAR (php-pear) – PHP Extension and Application Repository framework
PDO (php-pdo) – A database access abstraction module for PHP applications
MySQL (php-mysqlnd) – A module for PHP applications that use MySQL databases
PostgreSQL (php-pgsql) – A PostgreSQL database module for PHP
MongoDB (php-pecl-mongo) – PHP MongoDB database driver
SQLite (php-sqlite) – Extension for the SQLite V2 Embeddable SQL Database Engine
Memcache (php-pecl-memcache) – Extension to work with the Memcached caching daemon
Memcached (php-pecl-memcached) – Extension to work with the Memcached caching daemon
GD (php-gd) – A module for PHP applications for using the gd graphics library
XML (php-xml) – A module for PHP applications which use XML
MBString (php-mbstring) – A module for PHP applications which need multi-byte string handling
MCrypt (php-mcrypt) – Standard PHP module provides mcrypt library support
Select what you need: APCu, CLI, PEAR, PDO, MySQL, PostgreSQL, MongoDB, SQLite, Memcache, Memcached, GD, MBString, MCrypt, XML
More info about PHP APC from PHP APC Configuration and Usage Tips and Tricks
yum --enablerepo=remi,remi-php55 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
/etc/init.d/httpd stop
## OR ##
service httpd stop
/etc/init.d/nginx start ## use restart after update## OR ##service nginx start ## use restart after update |
/etc/init.d/php-fpm start ## use restart after update## OR ##service php-fpm start ## use restart after update
/sbin/chkconfig httpd off
CentOS / Red Hat (RHEL) 6/5
/sbin/chkconfig --add nginx /sbin/chkconfig --levels 235 nginx on
CentOS / Red Hat (RHEL)
/sbin/chkconfig --add php-fpm
/sbin/chkconfig --levels 235 php-fpm on
I use here testsite.local site, but this could of course be your real site, like www.if-not-true-then-false.com.
## public_html directory and logs directory ## mkdir -p /srv/www/testsite.local/public_html mkdir /srv/www/testsite.local/logs chown -R apache:apache /srv/www/testsite.local
Alternative setup to add logs under /var/log directory.
## public_html directory and logs directory ##
mkdir -p /srv/www/testsite.local/public_html
mkdir -p /var/log/nginx/testsite.local
chown -R apache:apache /srv/www/testsite.local
chown -R nginx:nginx /var/log/nginx
Note: I use apache user and group here, because PHP-FPM runs as apache default (apache choosed to be able to access some dir as httpd). If you use some other user on your php-fpm conf then change this accordingly.
mkdir /etc/nginx/sites-available mkdir /etc/nginx/sites-enabled
Add following lines to /etc/nginx/nginx.conf file, after “include /etc/nginx/conf.d/*.conf” line (inside http block).
## Load virtual host conf files. ##
include /etc/nginx/sites-enabled/*;
Add following content to /etc/nginx/sites-available/testsite.local file. This is very basic virtual host config.
server { server_name testsite.local; access_log /srv/www/testsite.local/logs/access.log; error_log /srv/www/testsite.local/logs/error.log; root /srv/www/testsite.local/public_html; location / { index index.html index.htm index.php; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /srv/www/testsite.local/public_html$fastcgi_script_name; } }
cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/testsite.local
/sbin/service nginx restart
/etc/hosts file Nginx on same machine
127.0.0.1 … row should look like example following:
127.0.0.1 localhost.localdomain localhost testsite.local
And if you use another machine where you are running your Nginx server, then add it’s public IP as following:
10.0.2.19 wordpress
Note: This is just very simple basic configuration, but if you want configure and optimize Nginx and PHP-FPM more then check following guide, Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks
Create /srv/www/testsite.local/public_html/index.php file with following content:
<?php
phpinfo();
?>
Access following address, with your browser. http://testsite.local/
Note:
If you get 403 forbidden error, then you probably have problem with SELinux, then run simply following command:
chcon -R -t httpd_sys_content_t /srv/www/testsite.local/public_html ## Or some apps might need httpd_sys_rw_content_t ## chcon -R -t httpd_sys_rw_content_t /srv/www/testsite.local/public_html
nano -w /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
/sbin/service iptables restart## OR ## /etc/init.d/iptables restart
Install Nginx/PHP-FPM on CentOS/RHEL,布布扣,bubuko.com
Install Nginx/PHP-FPM on CentOS/RHEL
标签:des style http color os io strong for
原文地址:http://my.oschina.net/linuxjd/blog/303417