Virtual host php calls, all revert to same host.

General discussion on PHP

Virtual host php calls, all revert to same host.

Postby kevi1283 on Wed Oct 28, 2015 10:42 pm

Problem description
Our HTTP Configuration has two virtual hosts.
One is tied to /www/testserver/websites/abctest
the other is tied to www/testserver/websites/xyztest

They both work fine for everything but php programs. When xyztest
tries to call a php program it actually goes looking for it in abctest.

This has to be a configuration problem but I just don't know a lot
about server configuration syntax. I have a RewriteCond and Rewrite
rule for files with a php extension but obviously it is too generic as
everything reverts back to abctest.

Perhaps it is an issue with the Zend configuration?

Each virtual host in the configuration has a section as seen below (All I can tell is any file with a .php extension is grabbed and routed to a path and port where the php is parsed and executed.)
30 # ProxyPreserveHost On
31 RewriteEngine on
32 RewriteCond %{REQUEST_FILENAME} ^.+\.php$ [NC]
33 RewriteRule ^/(.*) http://127.0.0.1:8001/$1 [P]
34 # ProxyPassReverse / http://127.0.0.1:8001/

Any help would be great.
kevi1283
 
Posts: 1
Joined: Wed Oct 28, 2015 10:36 pm

Re: Virtual host php calls, all revert to same host.

Postby scottgcampbell on Thu Oct 29, 2015 12:36 pm

Try turning on rewrite logging to see if you can tell what the problem is:

http://stackoverflow.com/questions/9632852/how-to-debug-apache-mod-rewrite

And post your COMPLETE httpd.conf (change any server names if you have any concerns) and any .htaccess access files (if any) as the issue could be in there.

Scott
scottgcampbell
 
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Virtual host php calls, all revert to same host.

Postby ronhextall on Thu Oct 29, 2015 2:30 pm

1 LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
2 LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
3 LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
4 LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
5 Listen *:8080
6 Options -ExecCGI -SymLinksIfOwnerMatch -Includes -IncludesNoExec -Indexes -MultiViews
7 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
8 LogFormat "%{Cookie}n \"%r\" %t" cookie
9 LogFormat "%{User-agent}i" agent
10 LogFormat "%{Referer}i -> %U" referer
11 LogFormat "%h %l %u %t \"%r\" %>s %b" common
12 CustomLog logs/access_log combined
13 LogMaint logs/access_log 7 0
14 LogLength 31457280
15 DocumentRoot /www/testserver/websites
16
17 NameVirtualHost *:8080
18 SetEnvIf "User-Agent" "Mozilla/2" nokeepalive
19 SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0
20 SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0
21 SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0
22 SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive
23 SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0
24 IndexOptions -DescriptionWidth -FancyIndexing -IconHeight -IconWidth -NameWidth -NameMinWidth -ScanHTMLTitles -ShowOwner -SuppressDescription -SuppressHTMLPreamble -SuppressIcon -SuppressLastModified -SuppressRules -SuppressSize
25
26 ProxyPreserveHost On
27 ProxyPassReverse / http://127.0.0.1:8001/
28
29 <VirtualHost *:8080>
30 # ProxyPreserveHost On
31 RewriteEngine on
32 RewriteCond %{REQUEST_FILENAME} ^.+\.php$ [NC]
33 RewriteRule ^/(.*) http://127.0.0.1:8001/$1 [P]
34 # ProxyPassReverse / http://127.0.0.1:8001/
35 RewriteCond %{REQUEST_METHOD} ^TRACE
36 RewriteRule .* - [F]
37 ServerName www.abc.com:8080
38 DirectoryIndex Welcome.htm
39 DocumentRoot /www/testserver/websites/abctest
40 ServerAlias abc.com
41 UserDir public_html
42 <Directory /www/testserver/websites/abctest>
43 Order Allow,Deny
44 Allow From all
45 </Directory>
46 <Directory /qsys.lib/abcdatatst.lib>
47 Allow From all
48 Order allow,deny
49 Options +ExecCGI
50 </Directory>
51 ScriptAlias /cgi-bin/db2www/ /qsys.lib/abcdatatst.lib/db2www.pgm/
52 Alias /ifs/ /www/testserver/websites/abctest/
53
54
55 </VirtualHost>
56 <VirtualHost *:8080>
57 # ProxyPreserveHost On
58 RewriteEngine on
59
60 RewriteCond %{REQUEST_URI} \/ifs\/ [NC]
61 RewriteCond %{REQUEST_FILENAME} !^.+\.php$ [NC]
62 RewriteCond %{REQUEST_FILENAME} !\/w2pout\/ [NC]
63 RewriteCond %{REQUEST_FILENAME} !\/Upload\/ [NC]
64 RewriteCond %{REQUEST_FILENAME} !^.+\.jpg$ [NC]
65 RewriteCond %{REQUEST_FILENAME} !^.+\.gif$ [NC]
66 RewriteCond %{REQUEST_FILENAME} !^.+\.css$ [NC]
67 RewriteCond %{HTTP_COOKIE} !^.*poslogin.*$ [NC]
68 RewriteRule ^.*$ http://www.poscorp.com [L]
69
70 RewriteCond %{REQUEST_FILENAME} ^.+\.php$ [NC]
71 RewriteRule ^/(.*) http://127.0.0.1:8001/$1 [P]
72 # ProxyPassReverse / http://127.0.0.1:8001/
73 RewriteCond %{REQUEST_METHOD} ^TRACE
74 RewriteRule .* - [F]
75 ServerName www.xyzcorp.com:8080
76 DirectoryIndex index.htm
77 DocumentRoot /www/testserver/websites/xyztest
78 ServerAlias xyzcorp.com
79 UserDir public_html
80 <Directory /www/testserver/websites/xyztest>
81 Order Allow,Deny
82 Allow From all
83 </Directory>
84 <Directory /qsys.lib/xyzdatatst.lib>
85 Allow From all
86 Order allow,deny
87 Options +ExecCGI
88 </Directory>
89 ScriptAlias /cgi-bin/db2www/ /qsys.lib/netdatatst.lib/db2www.pgm/
90 Alias /ifs/ /www/testserver/websites/xyztest/
91
92 </VirtualHost>
93
ronhextall
 
Posts: 26
Joined: Fri Jan 27, 2012 10:03 pm

Re: Virtual host php calls, all revert to same host.

Postby buy 4753 on Fri Jun 10, 2016 9:41 am

Very useful information. You know i am a beginner with PHP and the discussion about php is very helpful for me. I hope this information will become a good guide for me. Thanks a lot for sharing this useful information.
buy 4753
 
Posts: 1
Joined: Fri Jun 10, 2016 9:37 am
Location: uk

Re: Virtual host php calls, all revert to same host.

Postby alex1339 on Tue Aug 15, 2017 10:06 am

Very interesting. I'm not often using php but recently i've started a new project and it might help me. Thanks!
alex1339
 
Posts: 1
Joined: Tue Aug 15, 2017 10:02 am
Location: Arizona, USA


Return to PHP

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest