Get Apache VHost to load index.html instead of web directory - angularjs

I'm having no luck finding this question answered so I'm asking this myself.
To get my VHost working, I followed this answer. My (working) "httpd-vhosts.conf" file looks like this
<VirtualHost *:80>
ServerAdmin jesuscc1993#gmail.com
DocumentRoot "Z:/Projects/Web/MetalTxus Site"
ServerName metaltxus.test
ServerAlias www.metaltxus.test
<Directory "Z:/Projects/Web/MetalTxus Site">
#Options FollowSymLinks
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
As far as I know, I should change "Indexes" with "-Indexes" to make the web load "index.html" instead of the web directory.
However, when I did that, my WAMPServer wouldn't start. It would if I removed "FollowSymLinks" option but then all I got was a "403 - Forbidden" page ("you don't have permission to access "/" on this server").
As looking for a solution got me nowhere, I used this as my last resource.
I'm using latest WampServer version in Windows 8.1. I want to test an AngularJS application.
If you need any more information, go ahead and ask.

Try this :-
<VirtualHost *:80>
ServerAdmin jesuscc1993#gmail.com
DocumentRoot "Z:/Projects/Web/MetalTxus Site"
ServerName metaltxus.test
ServerAlias www.metaltxus.test
<Directory "Z:/Projects/Web/MetalTxus Site">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
The Require all granted is Apache 2.4 syntax where you were using Apache 2.2 syntax when using
Order deny,allow
Allow from all
Now all you need to do is place a file called index.html or index.php in the "Z:/Projects/Web/MetalTxus Site" folder.
I would suggest removing the space in the folder name MetalTxus Site its not absolutely necessary but it removes another possible complexity.
Also if you dont actually mean to give access to the site to The Universe try using
Require local
And if you want to be able to access the site just from other PC's on your internal network use
Require local
Require ip 192.168.1
ADDITIONAL SUGGESTION:
Also check httpd.con has thi sline uncommented
LoadModule dir_module modules/mod_dir.so
An has this
<IfModule dir_module>
DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>

Related

Can't access index.php after modifying the 000-default.conf to suit dms setup

So I've been trying to install Seeddms. I just re-flashed the os on my current samba server and wanted to add this DMS to just make life easier. I've flowed the steps mentioned on this website (Install Guide for old Seeddms). I am aware that this is for the old version of Seeddms and have changed all the version related code.
Question is...
What haven't I done to allow access to the index.php page after modifying the 000-default.conf ?
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory />
Require all granted
</Directory>
Alias /seeddms “/home/www-data/seeddms50x/seeddms-5.0.8/“
<Directory "/home/www-data/seeddms50x/seeddms-5.0.8/">
DirectoryIndex index.php
AllowOverride All
Order deny,allow
Deny from all
Allow from all
</Directory>
</VirtualHost>
Located in -> "/etc/apache2/sites-enabled/"
I try and access the install page using the web address of
http://steve/seeddms/install
(**steve being the name of the samba server)
However, no luck.
Any Ideas ?

How to change default Apache conf file for prestashop?

How to make prestashop to use prestashop.conf file which is a clone of 000.default.conf on my local server?
When I disable 000-default.conf, prestashop don't load.
When I enable that back, the web-page loads normally.
I've enabled prestashop.conf and reloaded/restarted Apache.
I use Apache2, prestashop 1.6.1, OS is Linux Mint.
Maybe someone can give me advice what else should I change. I haven't found solution so far.
P.S. prestashop.conf is complete clone of 000-default.conf.
Have you changed the paths to match these of your website?
<VirtualHost *:80>
ServerAdmin youradminlogin#yourwebsite.com
DocumentRoot "path/of/your/website"
ServerName website-name.com
Options All Indexes FollowSymLinks
<Directory "path/of/your/website">
DirectoryIndex index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require local
</Directory>
</VirtualHost>
Make shure it is in /etc/apache2/sites-enabled/ !
After modifying this, you'll need to restart the server (sudo apachectl restart)

Apache2 - Error 403 forbidden

I develop projects that I've located in /home/user/projects directory. This directory is chmod 777. The problem is that I'm always getting Error 403 Forbidden when I try to access this directory or any subdirectory. This is how my /etc/apache2/sites-available/000-default.conf looks like:
<VirtualHost *:80>
ServerName localhost
ServerAdmin user#user.com
DocumentRoot /home/user/projects
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Options +FollowSymLinks
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /home/gtakacs/projects>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
What's wrong with this? When I used /var/www as my document root, everything worked.
EDIT : try doing chmod -R 777 /home to make sure all your home is available (note that this solution is NOT RECOMENDED, having your project in /var/www would definitely be a better solution in my opinion)
(Can't comment so post reply)
Isn't there a config file in your project where you're supposed to set who can access the app? Check if you didn't forget to add your ip adress and domain name in this file.
When using Apache2 with Django framework (python), I had the same error, and it was because I forgot to add the domain name to authorized hosts.
You can also check access.log and error.log to have more detailed informations on what caused the error.
Command out:
#Order allow,deny
I had this issue before, the problem might be that your document root does not contain the described directories.

Apache2 serving multiple sites on one IP

I have two domains that point to the same IP, which is an Ubuntu VPS with apache2. I need to server both domains out of apache. I've read the config manual at http://httpd.apache.org/docs/2.0/vhosts/examples.html#purename and added the following two files:
1) webikenconsultants
<VirtualHost *:80>
ServerName www.webikenconsultants.com
DocumentRoot /var/www/coming_soon
<Directory /var/www/coming_soon>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
2) webikentrading
<VirtualHost *:80>
ServerName www.webikentrading.net
#WSGIScriptAlias / /opt/webikentrading/current/src/webikentrading/django.wsgi
DocumentRoot /var/www
<Directory /var/www >
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
As you can see, webikentrading is a Django project, but for the time being, just to get things working, I am serving it as a static site, until I figure out what's going on. The problem is that when I visit either domain, only the coming_soon content shows up, what am I doing wrong??
I figured out the problem. The vhost entry points to www.webikentrading.net however, the browser was using webikentrading.net so i added a separate entry for just webikentrading.net and all is fine
EDIT:
This is quite old, but I have a new and improved way of doing this now and I hope it can help someone else.
Use the mod_wsgi daemon directive which allows you to add the python path of your choice. Example config is:
<VirtualHost *:80>
ServerName qa.webiken.net
....
WSGIDaemonProcess qa.webiken.net processes=2 threads=15 python-path=/usr/local/pythonenv/QA-WEBIKEN-1/lib/python2.5/site-packages display-name=%{GROUP}
WSGIProcessGroup qa.webiken.net
</VirtualHost>
<VirtualHost *:80>
ServerName staging.webiken.net
....
WSGIDaemonProcess staging.webiken.net processes=2 threads=15 python-path=/usr/local/pythonenv/staging-WEBIKEN-1/lib/python2.5/site-packages display-name=%{GROUP}
WSGIProcessGroup staging.webiken.net
</VirtualHost>

VirtualHost - Server not found

I'm running different websites on my webserver using Apache VirtualHosts. Now I have troubles getting one site to work. When I browse to the site in Firefox it says "Firefox can't find the server at www.mydomain.com", even though it's spelled correctly.
Further traceroute and ping both resolve to the correct IP, so I doubt it is because of a DNS issue.
I copied the VirtualHost-config file from a working site and just changed the domains and path on the server, which is existent. Further I checked that the site is enabled (with a2ensite), restartet apache, reloaded apache, but it is still not working.
Here's my VirtualHost-File:
<VirtualHost censored_ip:80>
ServerName mydomain.com
ServerAlias mydomain.com www.mydomain.com
ServerAdmin <myemail>
DocumentRoot /var/www/efin/
<Directory /var/www/efin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error_efin.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
I hope someone can find the error here, since I have no idea where to look for it anymore. Thanks a lot in advance. I'd be happy to provide further information if needed.
Sincerely, Michael

Resources