如何在Linux下使Nginx和Apache共存,并同时支持PHP
1个回答
2017-05-05
展开全部
1、mysql,参考linux下源码安装mysql
2、php,参考linux下源码安装nginx + php笔录
编译参数:./configure --prefix=/usr/local/php --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-mysql=/usr/local/mysql --enable-fastcgi --enable-fpm --with-mysqli=/usr/local/mysql/bin/mysql_config
3、nginx,参考linux下源码安装nginx + php笔录
4、apache,
编译参数:./cigure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most
查看以前的编译选项(如果以前安装过的话):cat /usr/local/apache2/build/config.nice
http.conf添加以下两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
虚拟主机设置:
<VirtualHost 192.168.42.129>
ServerAdmin webmaster@test.com
DocumentRoot /var/www/other-test
ServerName other-test.com
ErrorLog logs/www.other-test.com-error_log
CustomLog logs/www.other-test.com-access_log common
<Directory "/var/www/other-test">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
DirectoryIndex index.html index.php
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
5、重新编译、安装php是能够在apache上运行,编译参数:./configure --prefix=/usr/local/php --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-mysql=/usr/local/mysql --with-zlib --enable-fastcgi --enable-fpm --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config
cp php.ini-dist /usr/local/php/lib/php.ini
重启apache,如果发现错误“cannot restore segment prot after reloc: Permission denied”解决方案:
1. chcon -t /usr/local/apache2/modules/libphp5.so
2. #vi /etc/sysconfig/selinux file 或者用 #gedit /etc/sysconfig/selinux file 修改SELINUX=disabled 重启
2、php,参考linux下源码安装nginx + php笔录
编译参数:./configure --prefix=/usr/local/php --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-mysql=/usr/local/mysql --enable-fastcgi --enable-fpm --with-mysqli=/usr/local/mysql/bin/mysql_config
3、nginx,参考linux下源码安装nginx + php笔录
4、apache,
编译参数:./cigure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most
查看以前的编译选项(如果以前安装过的话):cat /usr/local/apache2/build/config.nice
http.conf添加以下两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
虚拟主机设置:
<VirtualHost 192.168.42.129>
ServerAdmin webmaster@test.com
DocumentRoot /var/www/other-test
ServerName other-test.com
ErrorLog logs/www.other-test.com-error_log
CustomLog logs/www.other-test.com-access_log common
<Directory "/var/www/other-test">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
DirectoryIndex index.html index.php
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
5、重新编译、安装php是能够在apache上运行,编译参数:./configure --prefix=/usr/local/php --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-mysql=/usr/local/mysql --with-zlib --enable-fastcgi --enable-fpm --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config
cp php.ini-dist /usr/local/php/lib/php.ini
重启apache,如果发现错误“cannot restore segment prot after reloc: Permission denied”解决方案:
1. chcon -t /usr/local/apache2/modules/libphp5.so
2. #vi /etc/sysconfig/selinux file 或者用 #gedit /etc/sysconfig/selinux file 修改SELINUX=disabled 重启
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |