more than one 'www' folder with wamp - wamp

Actually I have one website in c:/wamp/www path.
But now I want to manage a bunch of websites, I can create the filesystem hierarchy in www with a folder for each website. But the problem is 'document_root' variable is always referring to c:/wamp/www
SCRIPT_FILENAME : c:/wamp/www/website1/index.php
DOCUMENT_ROOT : c:/wamp/www
while I'd like : c:/wamp/www/website1
Can I create a folder in wamp folder and refer to it when typing its URI in my browser ?
e.g.
http://localhost/ -> c:/wamp/www/index.html
http://website1/ -> c:/wamp/www/website1/index.php
thks

You need to use multiple VirtualHosts (one for each host name) and use a distinct document root in each of them.
More details are available here: http://httpd.apache.org/docs/2.2/vhosts/name-based.html

I usually create multiple virtual hosts for my projects:
add the following lines to C:\wamp\bin\apache\apache2.2.22\conf\httpd.conf
Listen 9191
NameVirtualHost *:9191
<VirtualHost *:9191>
ServerName web1.local
DocumentRoot "D:\VanCK\Projects\Web1\trunk\public_html"
<Directory "D:\VanCK\Projects\Web1\trunk\public_html">
AllowOverride All
Order Allow,Deny
Allow From all
</Directory>
</VirtualHost>
Listen 9292
NameVirtualHost *:9292
<VirtualHost *:9292>
ServerName web2.local
DocumentRoot "D:\VanCK\Projects\Web2\trunk\public_html"
<Directory "D:\VanCK\Projects\Web2\trunk\public_html">
AllowOverride All
Order Allow,Deny
Allow From all
</Directory>
</VirtualHost>
add the following lines to C:\Windows\System32\drivers\etc\hosts
127.0.0.1 web1.local
127.0.0.1 web2.local
enable rewrite_module (click on WAMP icon > Apache > Apache modules > check rewrite_module)
restart all services
=> http://web1.local:9191/ and http://web2.local:9292/

you need to add
Options Indexes FollowSymLinks
after :
AllowOverride All
Order Allow,Deny
Allow From all

Related

How to send all subdomains of my domain to the same server using AWS

I have a domain in AWS like example.com
But I want all requests of the subdomains, rea.example.com, exem2.example.com be sent to the same server.
For now I've created Record Set like *.example.com and it does not work.
When I set the subdomain as a new "record set" it works, but I need to answer to all subdomains, that are created dinamically by the application.
Thanks
Now is fixed. It was a missing configuration in the etc/httpd/httpd.conf. To allow all requests and resources be answered by the server.
In the httpd.conf was added:
Custom htaccess file
AccessFileName .htaccess
And was created another file in the folder:
etc/httpd/conf.d/
mydomain.conf
with the virtual hosts:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
SetEnv APPLICATION_ENV "production"
ServerName www.mydomain.com
ServerAlias *.mydomain.com.br
DocumentRoot /var/www/folder_app
<Directory />
Options FollowSymLinks
AllowOverride None
AllowOverride All
</Directory>
<Directory /var/www/folder_app>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>

access from another pc on lan network to django apache

Greetings and sorry for the english ..
I have the following problem and would appreciate if you can help me solve it:
I have set up django with apache and sample site by my email which is geounl.api/admin which resolved without any problem on my computer, but want to access from another PC connected to the same network I can not find the site ..
settings of my hosts is:
127.0.0.1 test.djangoserver
127.0.0.1 edgar-PC.edgar.com edgar-PC
127.0.1.1 prueba.djangoserver**
192.168.0.103 geounl.api -----------> ip address of my pc
and my virtualhots is:
<VirtualHost *:80>
ServerName geounl.api
DocumentRoot /home/edgar/Django/GeoUnl
<Directory /home/edgar/Django/GeoUnl >
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess geounl.api processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup geounl.api
WSGIScriptAlias / /home/edgar/Django/GeoUnl/apache/django.wsgi
Alias /static/ /home/edgar/Django/prueba/static/
<Directory /home/edgar/Django/prueba/static/>
Order deny,allow
Allow from all
</Directory>
Thanks and I hope your help

VirtualHost for django site on dedicated server with multiple web sites

So, i'm trying to run Django web site on my dedicated server which has multiple sites on itself and its folder structure looks like this:
home/user/www/
site1/
site2/
site3/
mydjangosite.com/
site1, site2 etc. are php/html web sites, and of course i need to keep them runing, so i'm wondering how should i configure my httpd.conf because these lines below are not working:
<VirtualHost *:80>
DocumentRoot home/user/www/mydjangosite.com
ServerName mydjangosite
WSGIScriptAlias / home/user/www/mydjangosite.com/testing/wsgi.py
<Directory "home/user/www/mydjangosite.com/testing">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
EDIT
I've modified my httpd.conf and instead of lines above (with VirtualHost *:80) i've added next:
WSGIScriptAlias / /home/user/www/mydjangosite.com/testing/wsgi.py
WSGIPythonPath /home/user/www/mydjangosite.com
<Directory /home/user/www/mydjangosite.com/testing>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
and finally i've got Django succes page:
It worked!
Congratulations on your first Django-powered page.
But now i get that Django page for every domain that is on my server.
Try this:
<VirtualHost *:80>
DocumentRoot /home/user/www/mydjangosite.com
ServerName mydjangosite
WSGIScriptAlias / /home/user/www/mydjangosite.com/testing/wsgi.py
<Directory "/home/user/www/mydjangosite.com/testing">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Instead of:
<VirtualHost *:80>
DocumentRoot home/user/www/mydjangosite.com
ServerName mydjangosite
WSGIScriptAlias / home/user/www/mydjangosite.com/testing/wsgi.py
<Directory "home/user/www/mydjangosite.com/testing">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Django to pass through some urls to base apache

Is there a way for Django to pass through some urls to whatever apache would resolve them too?
For instance, if I type in: http://< my-ip >. Is there a way to have django just serve up whatever is in /var/www/html/index.html?
Similarly, if I type in http://< my-ip >/devel, is there a way to make django simply serve what's in /var/www/html/devel/?
Basically, I want some urls to "not be touched".
Thanks!
Edit
Following Anentropic's comment, I'd like Apache to call Django only if it can't match the url. How would I need to change httpd.conf to do that? Let's say I want Django to respond to only /polls/, /admin/ and /accounts/.
Here's the relevant portion from my httpd conf file:
<VirtualHost *:80>
#DocumentRoot /home/ec2-user/srv/mysite
DocumentRoot /var/www/html/
ServerName <My IP ADDRESS>
WSGIScriptAlias / /home/ec2-user/srv/mysite/apache/wsgi.py
# Alias /phpmyadmin /var/www/html/phpmyadmin
# <Location /phpmyadmin>
# SetHandler None
# </Location>
<Directory /home/ec2-user/srv/mysite/media>
Order deny,allow
Allow from all
</Directory>
<Directory /home/ec2-user/srv/mysite/apache>
Order deny,allow
Allow from all
</Directory>
LogLevel warn
Alias /media/ /home/ec2-user/srv/mysite/media/
Alias /static/ /home/ec2-user/srv/mysite/static/
<Directory /home/ec2-user/srv/mysite/static>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
If you'd like to serve static html pages you could use the flatpages app.
Again if you'd like to use different languages (php etc) I believe that you'd have to set up different virtual host in you apache config file to catch the url before it gets served to Django and redirect it to the correct folder. i.e:
<VirtualHost *:80>
ServerName staging.mydomain.com
DocumentRoot /var/www/html/mydomain.com/staging/
</VirtualHost>
<VirtualHost *:80>
ServerName dev.mydomain.com
DocumentRoot /var/www/html/mydomain.com/dev/
</VirtualHost>
EDIT
<VirtualHost *:80>
#DocumentRoot /home/ec2-user/srv/mysite
DocumentRoot /var/www/html/
ServerName <My IP ADDRESS>
Alias /phpmyadmin /var/www/html/phpmyadmin
<Location /phpmyadmin>
SetHandler None
</Location>
<Directory /home/ec2-user/srv/mysite/media>
Order deny,allow
Allow from all
</Directory>
<Directory /home/ec2-user/srv/mysite/apache>
Order deny,allow
Allow from all
</Directory>
LogLevel warn
WSGIScriptAlias /polls /home/ec2-user/srv/mysite/apache/wsgi.py
WSGIScriptAlias /admin /home/ec2-user/srv/mysite/apache/wsgi.py
WSGIScriptAlias /accounts /home/ec2-user/srv/mysite/apache/wsgi.py
Alias /media/ /home/ec2-user/srv/mysite/media/
Alias /static/ /home/ec2-user/srv/mysite/static/
<Directory /home/ec2-user/srv/mysite/static>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

wamp vhost servername redirects to wamp homepage instead of the welcome page of CodeIgniter

I am a newbie in php using the framework codeigniter.
I want my servername to be directed to the welcome page of codeigniter.
And while setting up the vhost,
I had problems in vhost servername.
Everytime I access it, it redirects to the wampserver homepage.
I tried configuring it in the httpd-vhost.conf using this:
<VirtualHost 127.0.0.1>
DocumentRoot "C:/wamp/www"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:/wamp/www/mysite"
ServerName mysite.com
</VirtualHost>
I uncomment the Include conf/extra/httpd-vhosts.conf line
I also included the domain name in windows host file.
127.0.0.1 mysite.com
But still, every time I access mysite.com, it shows the wampserver homepage instead of the welcome page of codeigniter.
You need to uncomment:
NameVirtualHost *:80
in httpd-vhosts.conf. Maybe even make it
NameVirtualHost *
Make sure to use FollowSymLinks
<Directory "c:/wamp/www">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
and even make two virtual hosts.. one for domain.com
<VirtualHost *:80>
ServerName domain.com
DocumentRoot C:/wamp/www/domain
ErrorLog C:/wamp/www/domain/logs/error.log
CustomLog C:/wamp/www/domain/logs/access.log common
<Directory "c:/wamp/www">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and again for www.domain.com
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias www.domain.com
DocumentRoot C:/wamp/www/domain
ErrorLog C:/wamp/www/domain/logs/werror.log
CustomLog C:/wamp/www/domain/logs/waccess.log common
<Directory "c:/wamp/www">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
be sure you've created all the folders for the log files.
And btw I'm not 100% sure all of this will work.
Good resources on this topic:
Wamp Server: Multiple Virtual Hosts are not working on Windows
http://www.dennisplucinik.com/blog/2007/08/16/setting-up-multiple-virtual-hosts-in-wamp/