problem configuring virtual host

Problems with the Linux version of XAMPP, questions, comments, and anything related.

problem configuring virtual host

Postby argie01 » 21. January 2011 15:44

Hello,

I need a little help configuring a site on Apache.
I'm moving a web from an apache server (not xampp) to an lampp-apache server, on linux.

The old apache server has a virtual host configuration. So, when someone point to www.mysite.com, he was redirected to /var/www/mysite/
But on my lampp-server I don't need to write a dns entry like that. All I just need is to change the document root only for this site. But I'd like to request this site writing something like http://ip-server/mysite/

So, in the new server with lampp I enabled http-vhost.conf on httpd.conf, and then I added the following lines inside http-vhost.conf

<VirtualHost *:9090>
DocumentRoot /opt/lampp/htdocs/mysite/
</VirtualHost>

That's because all I need is that when someone point to http://ip-server:9090 Apache redirects it to the site /opt/lampp/htdocs/mysite/
So, the results of this request would be something like http://ip-server:9090/mysite/index.php
But it doesn't works.
Besides it, I have other site configured in lampp-apache, and it doesn't works after I enabled http-vhost.conf on httpd.conf.
I've checked this config by doing telnet to the port 9090, and it doesn't respond.

Thank you for your help.
argie01
 
Posts: 29
Joined: 19. July 2004 19:17

Re: problem configuring virtual host

Postby greno » 22. January 2011 02:54

Firewall.
greno
 
Posts: 54
Joined: 04. October 2006 19:25

Re: problem configuring virtual host

Postby argie01 » 22. January 2011 14:44

I don't think so. Because the OS is an Ubuntu server 10.04 + gnome, and the firewall is not installed by default (and I didn't installed it).
argie01
 
Posts: 29
Joined: 19. July 2004 19:17

Re: problem configuring virtual host

Postby greno » 22. January 2011 22:29

You must have Apache listening on 9090 and the firewall open on this port.
greno
 
Posts: 54
Joined: 04. October 2006 19:25

Re: problem configuring virtual host

Postby argie01 » 25. January 2011 12:50

But how can I configure Apache to listen at the port 9090 (and also at the port 80)?
Because I suppose that the virtual host would configure Apache for this port....

Thank you.
argie01
 
Posts: 29
Joined: 19. July 2004 19:17

Re: problem configuring virtual host

Postby Sharley » 25. January 2011 13:21

You may need to read the documentation to see what syntax a VirtualHost container requires to be effective:
http://httpd.apache.org/docs/2.2/vhosts/

Some good examples here:
http://httpd.apache.org/docs/2.2/vhosts/examples.html

Three essential components are, one to define whether you want to use an IP-Based vhost or a Name-Based vhost and two, to define a ServerName for your vhost so Apache can listen on port 80 using the defaults in the httpd.conf file and to be able to listen on port 9090 for a particular server name and three, to define the DocumentRoot for Apache to look in for the files to serve when requested.

The docs will help greatly in understanding what is required in your http-vhost.conf file.

Here is a very basic example, based on the info you have provided here, to enter into your httpd-vhosts.conf file:
Code: Select all
NameVirtualHost *:9090

<VirtualHost *:9090>
ServerName ip-server
DocumentRoot /opt/lampp/htdocs/mysite/
</VirtualHost>
http://ip-server:9090/ should then serve the index file it finds in the mysite directory.

Good luck and best wishes.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: problem configuring virtual host

Postby argie01 » 25. January 2011 18:18

Thank you!

I fixed the problem just adding the line "Listen 9090" inside httpd.conf.
argie01
 
Posts: 29
Joined: 19. July 2004 19:17


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 9 guests