Forum Moderators: phranque

Message Too Old, No Replies

How to run multiple web applications in apache server?

         

rsridharan

6:02 pm on Mar 6, 2007 (gmt 0)

10+ Year Member



Can someone please tell me how I can run multiple web applications in apache web server?

That is for eg., I am involved in one html, and two php based projects, each having different folder structure and unconnected to each other.

But, I have only one document root in the web server httpd.conf file pointing to htdocs So whenever I call the webserver domain it runs the one in teh htdocs directory?

Should I delete each time my project and copy the other files in order to test other projects?

Please Advice.

Thanks.

coopster

6:57 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, rsridharan.

You want to look into Apache's Virtual Hosts [httpd.apache.org] options.

rsridharan

6:14 pm on Mar 6, 2007 (gmt 0)

10+ Year Member




System: The following 2 messages were spliced on to this thread from: http://www.webmasterworld.com/apache/3272855.htm [webmasterworld.com] by jdmorgan - 2:30 pm on Mar. 6, 2007 (CDT -6)


I have a domain let's say example.com. DNS is properly done and it is pointing ot my machines IP and all.

I have two web applications existing in two different folders I would like to run using project1.exmaple.com and project2.example.com pattern.

Can I do this using virtual host?

my www.example.com (when I use my real domain) is bringing up the htdocs index.html file properly.

under htdocs I have two folders project1 and project2 in which I have the index.php files and a lot others.

I would like to configure my server in such a way that when I call

[project1.example.com...] it should automatically point to the index.php in the htdocs/project1 folder and similarly [project2.example.com...] should point to htdocs/project2 folder.

If I cant do the above I would like to do the same using URL like

www.example.com/project1 and www.example.com/project2 to access the projects in teh project1 and project2 folder respectively is that possible?

Can this be done? Can someone provide answer how I can cofigure the servers to do above (all scenarious).

Please advice thanks a lot.

appi2

6:50 pm on Mar 6, 2007 (gmt 0)

10+ Year Member



Last example of this page. Maybe?
Apache VirtualHost Examples [httpd.apache.org]

rsridharan

9:03 pm on Mar 6, 2007 (gmt 0)

10+ Year Member



Hi,
I already read those, I am kinda confused a bit, I understood concept, I just want someone to explain in simple english with some examples like how it can be done?

Is that to be done in virtual hosts or script alias or something. I can try out on my one, but it takes a lot of time to do each trial and error and on top of that, if some mistakes are made, not sure whether these dont work, because of the mistakes I made or, I am in the wrong area of congifuration and things like that!.

Thx.

rsridharan

9:08 pm on Mar 6, 2007 (gmt 0)

10+ Year Member



hi appi2, thx, I will try those last examples of the above link.

Just curious;

can I accomplish running two php applications

www.example.com/phpapp1 (htdocs/phpapp1 doc root)
www.example.com/phpapp2 (htdocs/phpapp2 doc root)

By using alias?
(I mean I could have tried this instead of asking here, but I can try only when I go home tonight from work and try this, so by then, I could get the idea whether it can be done the above way or not by discussing here!)

Thanks.

rsridharan

4:56 pm on Mar 7, 2007 (gmt 0)

10+ Year Member



Hi, I tried the scriptalias and alias as well.

When I used alias nothing happened I just got an empty page. I guess the phps wont get executed with alias!.

I put ;

scriptalais "/php1/" "c:/path/path/php1/"

<directory .. "c:/path/path/php1"> / No ending slash (as it were for the cgi-bin folder)

options.. etc. like that

<end>

I got 403 forbidden message!. I used the same privileges that existed for the 'cgi-bin' directory in the apache httpd.conf file (as it comes).

Can someone tell what could be the issue?

equalm

7:19 pm on Mar 8, 2007 (gmt 0)

10+ Year Member




I think you need to read through what people have posted. You can host multiple sites on a single IP address by invoking "NameVirtualHost" directives. You should read a little more on it. Many sites can live on one IP address, but they're distinguished by their ServerName (ie. your domain names), so when the http request comes in, Apache sees the IP and the domain they're asking for, and directs them to the proper VirtualHost that you've setup.