apache 多站点多端口配置错误

jeffseo 发布于 2014/02/28 16:56
阅读 1K+
收藏 1

今天配置服务器时遇到一个奇怪的问题,那位高手能够帮忙解答一下,万分感谢。

我的配置如下:
apache+php+mysql
同时开始了80,8080,8081,8082等等端口,计划的是用nginx做前台反向代理,后端的apache服务器放多个magento站点。反向代理已经能够正确的访问到后端,问题是出在apache的配置上。

症状如下:
测试域名指向后端的时候,虚拟服务器用80端口;
通过域名访问,通过IP+port访问均正常;

虚拟服务器开8082端口时,
访问域名和通过IP+port访问,均会打开apache的那个成功安装画面(httpd.conf默认的  DocumentRoot "/usr/local/apache/htdocs"),不是我的虚拟机路径)

另外,如果域名解析到前端nginx,访问域名还会出现重定向过多错误。

过程中只改了一个端口号,其余未做任何更改。iptables开启了8082端口,也有listen 8082。

配置文件如下:

#httpd-vhosts.conf配置内容
<VirtualHost 11.22.333.444:8082>
ServerName www.domain.com
ServerAlias www.domain.com
DocumentRoot /home/wwwroot/www.domain.com/web
DirectoryIndex index.php index.html index.htm
<Directory /home/wwwroot/www.domain.com/web>
Options FollowSymLinks
AllowOverride All
Order Deny,Allow
Allow from All
php_admin_value open_basedir /home/wwwroot/www.domain.com/web:/tmp:/proc
</Directory>
ErrorLog  /home/wwwroot/www.domain.com/logs/error.log
TransferLog  /home/wwwroot/www.domain.com/logs/access.log
</VirtualHost>




#httpd.conf配置

ServerRoot "/usr/local/apache"
Listen 80
Listen 8080
Listen 8081
Listen 8082
Listen 8083
Listen 8084
Listen 8085
Listen 8086
Listen 8087
Listen 8088
Listen 8089
LoadModule deflate_module modules/mod_deflate.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module        modules/libphp5.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User www
Group www

</IfModule>
</IfModule>

ServerAdmin you@example.com
ServerName example:80

DocumentRoot "/usr/local/apache/htdocs"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

<Directory "/usr/local/apache/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" common

</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "/usr/local/apache/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
Addtype application/x-httpd-php .php


</IfModule>

# Virtual hosts
Include conf/extra/httpd-vhosts.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>



#网站的.htaccess配置:

    DirectoryIndex index.php

<IfModule mod_php5.c>

    php_flag magic_quotes_gpc off
    php_flag session.auto_start off
    php_flag suhosin.session.cryptua off
    php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

</IfModule>

<IfModule mod_ssl.c>
    SSLOptions StdEnvVars
</IfModule>

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^api/rest api.php?type=rest [QSA,L]
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]

</IfModule>

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

<IfModule mod_expires.c>

    ExpiresDefault "access plus 1 year"

</IfModule>

    Order allow,deny
    Allow from all

    <Files RELEASE_NOTES.txt>
        order allow,deny
        deny from all
    </Files>






加载中
返回顶部
顶部