Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Question
I have tried and read all sort of questions on this topic but can't get this to work. I am trying to use a virtual host to access a different folder than the default /www that wamp uses. But i keep getting an error;
Forbidden
You don't have permission to access / on this server.
I can access local host and phpmyadmin perfectly but not any virtual hosts that i create.
httpd-vhosts.conf
# Virtual Hosts
#
# Required modules: mod_log_config
Listen 80
<VirtualHost *:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Program Files (x86)\2. Apps\Wamp\www"
ServerName localhost
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Users\Chris\Documents\CBull Files\Projects\Tests"
ServerName test.lo
ServerAlias test.lo
<directory "C:\Users\Chris\Documents\CBull Files\Projects\Tests">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
hosts
# Wamp Server Settings
127.0.0.1 localhost
127.0.0.1 test.lo
httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Thanks
Thanks for everyone's input, there were two main problems
I installed wamp into a folder which was nested in a folder who's name had a space in so c:/folder/folder with a space/wamp/ which i have since been told is bad practice, if anyone knows why please tell.
The were issues with the internet protocol, namely ipv6, so solve this you need to ensure wamp only uses ipv4, inside httpd.conf find Listen 80 and change to Listen 0.0.0.0:80. Again i'm not sure what this does so if anyone knows please post below.
I hope this helps anyone else stuck.
Try replacing the following block with:
<VirtualHost test.lo:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Users\Chris\Documents\CBull Files\Projects\Tests"
ServerName test.lo
ServerAlias test.lo
<directory "C:\Users\Chris\Documents\CBull Files\Projects\Tests">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
I have made just one change: <VirtualHost *:80> replaced with <VirtualHost test.lo:80>.
Note: You had </VirtualHost> missing in the end.
Related
when attempting to connect through public IP it gives the above error. sometimes in the error log, it says blocked by configs. however, it still shows up in the access log. this is the vhosts file:
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "C:/wamp64/www"
<Directory "C:/wamp64/www/">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I tried a number of things such as restating and using different devices.
edit: I get the same error even if the server is offline.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Hello all am new to django and all its goodies ill like to know how to set up something like this with nginx and gunicorn for a django project thanks
virtual host1
<VirtualHost *:80>
ServerName project1.com
ServerAlias www.project1.com
ServerAdmin info#project1.com
Alias /static/ /path/to/project1/project1/static/
Alias /media/ /path/to/project1/project1/media/
ErrorLog /path/to/project1/error.log
CustomLog /path/to/project1/access.log combined
WSGIDaemonProcess project1.com processes=2 threads=15 display-name=%{GROUP} python-path=/path/to/project1:/path/to/project1/local/lib/python2.7/site-packages
WSGIProcessGroup project1.com
WsgiScriptAlias / /path/to/project1/project1/wsgi.py
<Directory /path/to/project1/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
virtual host 2
<VirtualHost *:80>
ServerName project2.com
ServerAlias www.project2.com
ServerAdmin info#project2.com
Alias /static/ /path/to/project2/project2/static/
Alias /media/ /path/to/project2/project2/media/
ErrorLog /path/to/project2/error.log
CustomLog /path/to/project2/access.log combined
WSGIDaemonProcess project2.com processes=2 threads=15 display-name=%{GROUP} python-path=/path/to/project2:/path/to/project2/local/lib/python2.7/site-packages
WSGIProcessGroup project2.com
WsgiScriptAlias / /path/to/project2/project2/wsgi.py
<Directory /path/to/project2/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Take a look at http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/ - that should be enough to get you started with nginx and gunicorn.
I'm using Wamp 2.2, edited conf/extra/httpd-vhosts.conf edited this file to add VirtualHosts , but when I un-commented line in httpd.conf to include httpd-vhosts.conf file, after restarting Wamp doesn't starts. If I revert changes is works fine.
Any ideas why is this happening?
This is code I'm using in httpd-vhost.conf:
<VirtualHost *>
ServerAdmin admin#localhost.com
DocumentRoot "C:/wamp/www" # change this line with your htdocs folder
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# WooCommerce Multisite
<VirtualHost dev.lo>
ServerAdmin admin#localhost.com
DocumentRoot "C:/wamp/www/dev"
ServerName dev.lo
ServerAlias dev.lo
<Directory "C:/wamp/www/dev">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Thanks
George
Edit
As Andreas Hagen suggested, I run Apache via httpd.exe.
First error was wrong parameter for DocumentRoot, as appears comment like was taken as second parameter, when DocumentRoot accepts only one.
Then I got warning: [warn] NameVirtualHost *:80 has no VirtualHosts. Did a quick search and found very helpful question - https://serverfault.com/questions/1405/apache-2-startup-warning-namevirtualhost-80-has-no-virtualhosts
Probably some bad config in vhosts file. Try to start apache from commandline so you get the error output. That will help you identify your problem.
Open your hosts file (\WINDOWS\system32\drivers\etc\hosts).
Add this line to the bottom:
127.0.0.1 test
This will tell your computer that any url that contains test will be routed to 127.0.0.1 (localhost).
Now open httpd.conf and add this to the very bottom of the file:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/myfirstsite/"
ServerName testsite
</VirtualHost>
Now restart apache and navigate to: http://test/ (you may have to restart your browser for the changes to take effect.)
Hope this works.
Go to C:/drive and choose wamp folder
and go to C:\wamp\bin\apache\Apache2.4.4\conf and choose httpd.conf file.
Edit with notepad and go to 58 line number
change Listen 80 and replace Listen 8181 Save file and restart your Apache server
Now check url such like this localhost:8181
I have used this hop you will be success.
i have apache2.conf
<VirtualHost 91.218.230.130:8080>
ServerName dopisaka.ru
DocumentRoot /var/www/dopisalki.ru/data/www/dopisaka.ru
SuexecUserGroup dopisalki.ru dopisalki.ru
CustomLog /var/www/httpd-logs/dopisaka.ru.access.log combined
ErrorLog /var/www/httpd-logs/dopisaka.ru.error.log
ServerAlias www.dopisaka.ru
ServerAdmin 911#dopisalki.ru
AddDefaultCharset utf-8
<Directory "/var/www/dopisalki.ru/data/www/dopisaka.ru">
Order allow,deny
Allow from all
</Directory>
Alias /manager/ "/var/www/dopisalki.ru/data/www/dopisaka.ru/manager/"
ScriptAlias /cgi-bin/ /var/www/dopisalki.ru/data/www/dopisaka.ru/cgi-bin/
WSGIScriptAlias / /var/www/dopisalki.ru/data/www/dopisaka.ru/django.wsgi
</VirtualHost>
but http://www.dopisaka.ru/ show just a "Index of".
whats wrong?
You have included an IP address in the VirtualHost directive. Did you provide a compatible NameVirtualHost directive using that IP address along with the port? If you didn't then likely that the VirtualHost configuration isn't being used at all, and instead the default virtual host definition is being used and it is that which is set up to return the index. More often that not using an IP address in VirtualHost is not what you want to do and you should just use '*:8080', still remembering though that you need a matching NameVirtualHost directive.
Try to remove the DocumentRoot directive. Also your wsgi script seem to be under DocumentRoot, you don't want the script under DocumentRoot because that make it readable by everyone.
I have a django app that requires some user credentials. I want to send login/register data over HTTPS. I've self-generated a certificate to test out and have also requested an external certificate, though that's pending.
I want to make sure that I don't royally screw up my AWS instance. I've grabbed pieces from different tutorials. For instance, in one tutorial, the SSLCertificateKeyFile was a .pem file but another tutorial had it as a .key file. I could only find a .key file in my dirs, so I just used that. Also, I'm not sure if "IfDefine" conditional is necessary/applicable and I also don't know whether the last line of my SSL virtual host, which seems to be making a change based on sniffing IE, should be included.
My mod-WSGI config normally looks like this:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /home/dir/
Alias /media/ /home/dir/public_html/media/
<Directory /home/dir/public_html/media>
Options -Indexes
Order deny,allow
Allow from all
</Directory>
Alias /admin_media/ /home/dir/project/admin/
<Directory /home/dir/project/admin >
Order deny,allow
Allow from all
</Directory>
WSGIScriptalias / /home/dir/project/apache/django.wsgi
WSGIScriptalias / /home/dir/project/apache/django.wsgi
<Directory /home/dir/project/apache >
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
</VirtualHost>
I've added the following virtual host for https connections:
<IfDefine SSL>
<VirtualHost *:443>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /home/dir/
SSLEngine on
SSLCertificateFile /usr/lib/ssl/www.mysite.com.crt
SSLCertificateKeyFile /usr/lib/ssl/www.mysite.com.key
#SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
</IfDefine>
Does this look about right? Is this sufficient to start requiring https for certain views via a custom decorator? I also want to require https for requests to admin. I've seen the following:
RewriteRule (.*) https://example.com/$1 [L,R=301]
...
I wasn't sure how to make that RewriteRule work without getting rid of Alias-ing. How should I handle that?
Thanks!