| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-21-2012, 12:54 PM
|
#1
|
|
LQ Newbie
Registered: May 2006
Posts: 13
Rep:
|
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
|
|
|
|
09-21-2012, 01:16 PM
|
#2
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
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.
|
09-21-2012, 01:41 PM
|
#3
|
|
LQ Newbie
Registered: May 2006
Posts: 13
Original Poster
Rep:
|
Quote:
Originally Posted by acid_kewpie
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.
|
|
|
|
09-21-2012, 03:01 PM
|
#4
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
right so where is the wordpress installation relative to "/etc/apache2/htdocs"?
|
|
|
|
09-21-2012, 04:19 PM
|
#5
|
|
LQ Newbie
Registered: May 2006
Posts: 13
Original Poster
Rep:
|
Quote:
Originally Posted by acid_kewpie
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.
|
|
|
|
09-22-2012, 03:08 PM
|
#6
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
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.
|
|
|
|
09-25-2012, 01:44 PM
|
#7
|
|
LQ Newbie
Registered: May 2006
Posts: 13
Original Poster
Rep:
|
Quote:
Originally Posted by acid_kewpie
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:44 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|