apache nginx 共存 详细配置

来源:互联网 发布:2016二级c语言考试真题 编辑:程序博客网 时间:2024/05/21 14:47

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

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 /tmpwget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpmrpm -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_installationmysql 安全设置 

Install httpd

yum install httpdchkconfig --levels 235 httpd on

Install nginx

yum install nginxchkconfig --levels 235 nginx on

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

service httpd start | stop | restartservice nginx start | stop | restart
yum install mod_fastcgi php-fpm
chkconfig --levels 235 php-fpm onservice 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
<?phpphpinfo();?>
再装一次吧,反正也无所谓。

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/phpmyadminAlias /phpMyAdmin /usr/share/phpmyadminAlias /mysqladmin /usr/share/phpmyadmin

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

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


原创粉丝点击