LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-21-2012, 12:54 PM   #1
mcc28
LQ Newbie
 
Registered: May 2006
Posts: 13

Rep: Reputation: 0
Question Help with ReverseProxy on Ubuntu


Hi,

I have Ubuntu server running with Apache installed and working. I have a virtual WordPress appliance(Virtualbox) running on the server.

The server ip is 192.168.0.32 and the WordPress server is on 192.168.0.14. To reach the WordPress server I type 192.168.0.14/wordpress - using the hostname (wordpress) doesn't work and I can't ping it on the network (but I can ping 192.168.14).

The Ubuntu server hostname is thaddeus and I want to be able to type http://thaddeus/wordpress and reach the wordpress appliance running at 192.168.0.14/wordpress - I understand Proxypass/ProxypassReverse do this...

Under sites-available I have added the file wordpress:

Code:
#This is for virtual host sites on server2 @ 192.168.0.14
<VirtualHost *:80>
        ServerAdmin webmaster@domain.com
        ServerName elswhere.domain.com
# You can have list of space separated aliases if you server2 hosts multiple domains
        ServerAlias wordpress
# If you have multiple hosts (NameVirtualHosts on server 2, you will need to preserve
# hostname, or you will always land at the root of
# the second server. ie: what ever the default site is.
        ProxyPreserveHost on
# Need to allow location / if you want the proxy to
# work when no folder is written in the url.
         <location />
          allow from all
     </location>

# This is where all the magic happens.
# You can modify the following for specific folders only and any remote host
# you can also specify a different port if you like
        ProxyPass /wordpress http://192.168.0.14/
        ProxyPassReverse /wordpress http://192.168.0.14/

</VirtualHost>
~
and enabled the site & restarted Apache. It doesn't work though - the Apache error log says /var/www/wordpress does not exist.

Could anyone help please?

thanks

Mark
 
Old 09-21-2012, 01:16 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Code:
        ServerName elswhere.domain.com
        ServerAlias wordpress
one of these needs to be "thaddeus" or the virtualhost will not match.

also you have illogical config on the ProxyPass. If you map "/wordpress" to "http://1.2.3.4/" then "http://thaddeus/wordpress" will be converted to "http://1.2.3.4/", not "http://1.2.3.4/wordpress". Also you need to match the slashes there, as otherwise "http://thaddeus/wordpress/something/else" will map to "http://1.2.3.4//something/else" which would usually actually work but is clearly messy and can lead to other mess, esp on the ProxyPassReverse side.
 
1 members found this post helpful.
Old 09-21-2012, 01:41 PM   #3
mcc28
LQ Newbie
 
Registered: May 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Lightbulb

Quote:
Originally Posted by acid_kewpie View Post
Code:
        ServerName elswhere.domain.com
        ServerAlias wordpress
one of these needs to be "thaddeus" or the virtualhost will not match.

also you have illogical config on the ProxyPass. If you map "/wordpress" to "http://1.2.3.4/" then "http://thaddeus/wordpress" will be converted to "http://1.2.3.4/", not "http://1.2.3.4/wordpress". Also you need to match the slashes there, as otherwise "http://thaddeus/wordpress/something/else" will map to "http://1.2.3.4//something/else" which would usually actually work but is clearly messy and can lead to other mess, esp on the ProxyPassReverse side.
Hi Thanks for this, I have amended the virtualhost file and it looks like this:

Code:
#This is for virtual host sites on server2 @ 192.168.0.14
<VirtualHost *:80>
        ServerAdmin webmaster@domain.com
        ServerName thaddeus
# You can have list of space separated aliases if you server2 hosts multiple domains
        ServerAlias wordpress
# If you have multiple hosts (NameVirtualHosts on server 2, you will need to preserve
# hostname, or you will always land at the root of
# the second server. ie: what ever the default site is.
        ProxyPreserveHost on
# Need to allow location / if you want the proxy to
# work when no folder is written in the url.
         <location />
          allow from all
     </location>

# This is where all the magic happens.
# You can modify the following for specific folders only and any remote host
# you can also specify a different port if you like
        ProxyPass /wordpress http://192.168.0.14/
        ProxyPassReverse /wordpress http://192.168.0.14/

</VirtualHost>
~
If I browse to thaddeus/wordpress it now works but there are some errors still. Notably some links and some content does not render correctly. Below is the apache error.log

Code:
[Fri Sep 21 19:35:14 2012] [error] [client 192.168.0.6] File does not exist: /etc/apache2/htdocs, referer: http://thaddeus/wordpress
[Fri Sep 21 19:35:14 2012] [error] [client 192.168.0.6] File does not exist: /etc/apache2/htdocs, referer: http://thaddeus/wordpress
[Fri Sep 21 19:35:26 2012] [error] [client 192.168.0.6] File does not exist: /etc/apache2/htdocs, referer: http://thaddeus/wordpress
[Fri Sep 21 19:35:39 2012] [error] [client 192.168.0.6] File does not exist: /etc/apache2/htdocs, referer: http://thaddeus/wordpress
[Fri Sep 21 19:35:39 2012] [error] [client 192.168.0.6] File does not exist: /etc/apache2/htdocs, referer: http://thaddeus/wordpress
[Fri Sep 21 19:35:39 2012] [error] [client 192.168.0.6] File does not exist: /etc/apache2/htdocs, referer: http://thaddeus/wordpress
Is this to do with the ProxyPassReverse setting?

Further help appreciated...thank you.
 
Old 09-21-2012, 03:01 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
right so where is the wordpress installation relative to "/etc/apache2/htdocs"?
 
Old 09-21-2012, 04:19 PM   #5
mcc28
LQ Newbie
 
Registered: May 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
right so where is the wordpress installation relative to "/etc/apache2/htdocs"?
Hi,

I can't really answer this! I can't find a directory htdocs under Apache2.

When I browse to thaddeus/wordpress - none of the graphics load, some of the links point to an incorrect location, for example the link to LOGIN to Wordpress points to (hovering over the link) thaddeus/wp-login.php but it should point to thaddeus/wordpress/wp-login.php - something is wring with the path but not sure what?

Wordpress is installed on /var/www/wordpress on the virtual machine (hostname - wordpress)

Last edited by mcc28; 09-21-2012 at 04:20 PM.
 
Old 09-22-2012, 03:08 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
right so it's your config that's referencing /etc/apache2/htdocs... I don't think that's a default, but clearly you need to set a correct DocumentRoot for it to work.
 
Old 09-25-2012, 01:44 PM   #7
mcc28
LQ Newbie
 
Registered: May 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Wink

Quote:
Originally Posted by acid_kewpie View Post
right so it's your config that's referencing /etc/apache2/htdocs... I don't think that's a default, but clearly you need to set a correct DocumentRoot for it to work.
Hi,

Been away for a few days so I will check this out and see if it resolves the issues.

thanks
 
  


Reply

Tags
apache, ubuntu, virtual machines


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache problem with proxy and reverseproxy sameone General 39 10-10-2011 04:38 AM
LXer: Ubuntu Restricted Extras - Lets Ubuntu Play Everything [Ubuntu for Beginners Sc LXer Syndicated Linux News 0 04-20-2010 12:10 AM
Can't figure out Apache VirtualHosts + Tomcat + ReverseProxy + RewriteRules rave8151 Linux - Server 3 07-16-2008 11:15 AM
a good reverseproxy mod_proxy implementation repolona Linux - Server 0 12-21-2006 03:05 AM
Help! Apache Reverseproxy & cache server maheshk78 Linux - General 0 11-16-2006 01:26 AM


All times are GMT -5. The time now is 07:55 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration