apache nginx 共存 详细配置

虽然全是英文,相信各位一定能看懂的,不翻译了    ^_^  按照步骤就行了。 有问题的话的留言。

We need to install mod_fastcgi later on which is available in the RPMforge repositories. RPMforge can be enabled as follows:

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

cd /tmp
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm


Install mysql

yum install mysql mysql-server
chkconfig --levels 235 mysqld on
service mysqld start

这里可以查看一下系统的端口。

netstat -tnl

可以查看到 系统已经打开3306端口

mysql_secure_installation

mysql 安全设置 

Install httpd

yum install httpd
chkconfig --levels 235 httpd on

Install nginx

yum install nginx
chkconfig --levels 235 nginx on

注意:这里一定注意只能打开一个http服务器,不然会出现"Job failed"

service httpd start | stop | restart
service nginx start | stop | restart
yum install mod_fastcgi php-fpm
chkconfig --levels 235 php-fpm on
service php-fpm start | stop | restart
php-fpm启动后,9000端口打开。

Install PHP

yum install php
yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
yum install php-pecl-apc

Configuring Apache with php-fpm

vi /etc/httpd/conf.d/fastcgi.conf

如果该文件不存在,则新建。

        <IfModule mod_fastcgi.c>
                DirectoryIndex index.html index.shtml index.cgi index.php
                AddHandler php5-fcgi .php
                Action php5-fcgi /php5-fcgi
                Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
                FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
        </IfModule>

将以上内容添加到fastcgi.conf

The /usr/lib/cgi-bin/ directory must exist, so we create it as follows:

mkdir /usr/lib/cgi-bin/ 

If mod_php is installed and enabled, we need to disable it. Open /etc/httpd/conf.d/php.conf...

vi /etc/httpd/conf.d/php.conf

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
  LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule !prefork.c>
  LoadModule php5_module modules/libphp5-zts.so
</IfModule>


#
# Cause the PHP interpreter to handle files with a .php extension.
#
#AddHandler php5-script .php
#AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

启动httpd

service httpd start
vi /var/www/html/info.php
<?php
phpinfo();
?>
再装一次吧,反正也无所谓。

yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
yum install php-pecl-apc 
systemctl reload php-fpm.service 或 service php-fpm restart



最后再装phpmyadmin吧:

yum install phpmyadmin
vi /etc/httpd/conf.d/phpmyadmin.conf

#
#  Web application to manage MySQL
#

#<Directory "/usr/share/phpmyadmin">
#  Order Deny,Allow
#  Deny from all
#  Allow from 127.0.0.1
#</Directory>

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

最后重启各种服务器就可以了。

我的Fedora系统暂时无法截图。可能会出现权限问题,注意修改好用户群组就行了。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值