My apache2 VirtualHost keep showing "It's working" instead of my site - apache

I'm doing a project for school where I have to host 2 pages on a web server. I chose to do a VirtualHost using Apache2 but when it keeps showing me a "It works" page. The page is located here.
We are using a DNS server but the probleme seems to not be coming from this one.
Here is one of the .conf file :
<VirtualHost *:80>
ServerAdmin jongen.philemon#wt5.ephec-ti.be
ServerName wt5.ephec-ti.be
ServerAlias www.wt5.ephec-ti.be
DocumentRoot /var/www/monsite
<Directory /><br>
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/monsite>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
I also changed the apache2.conf like this:
<VirtualHost *:80>
ServerAdmin jongen.philemon#wt5.ephec-ti.be
DocumentRoot /var/www/site
<Directory /var/www/site/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
You can also check our wiki on the GitHub to see all the steps I followed.
Thank's

I got to fix it by re-doing it using a Dockerfile. I uptated the files and the wiki on my github if you have the same issue !

Related

mywebsite.com shows index of / after installing Magento

I am running Virtual server by:
VirtualBox v5.2.12
Ubuntu v18.04
Apache v2.4.29
php 7.1.17
Magento v2.2.4
Everything goes fine till I install magento! Magento works find without any problem in the server but the problem here is when I entered mywebsite.com it shows my files and indexing and I want to show my index.html instead:
Index of /
Name Last modified Size Description
index.html 2018-05-28 03:47 180
info.php 2018-06-04 12:39 20
magento2/ 2018-05-01 23:21 -
Apache/2.4.29 (Ubuntu) Server at mywebsite.com Port 65533
I tried a lot of answer but without any success.
Here is /etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
And Here is /etc/apache2/sites-available/mywebsite.com.conf
Listen 65533
<VirtualHost mywebsite.com:65533>
ServerName www.mywebsite.com
ServerName mywebsite.com
ServerAdmin info#mywebsite.info
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot /var/www/mywebsite.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mywebsite.com/html/>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Here is /etc/apache2/sites-available/000-default.conf.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Finally I solved the issue .. been trying for a week!
The solution is:
Step 1- Inside this file "/etc/apache2/sites-available/mywebsite.com.conf" this should be the first directory strait after the virtualhsost info:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
And it will effect the whole file.. ok so far so good.
Step 2- I added a new directory specially for magento which is
<Directory /var/www/mywebsite.com/html/magento2>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
Step 3- sudo /etc/init.d/apache2 restart in order to restart the apache with status or just use any method to restart.
** The point here is you need to avoid directory Inheritance / one setting for all in order to work with each directory separately.
Hope someone get benefit from this post.
Thank you Andra for the little help.
Regards,
QLF

403 Forbidden vhost Ubuntu

Trying to setup my webserver and allow .htaccess in all www directories. When accessing sub.domain.com on my laptop (with host files adjusted), returns a 403 Forbidden. "You don't have permission to access / on this server."
It feels like the .htaccess file is not allowed, and therefore throws the 403. But as per my understanding the settings are correct isn't? Am I overlooking something?
apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
AllowOverride All
</Directory>
domain.com.conf
<VirtualHost *:80>
ServerName domain.com
ServerAlias sub.domain.com
ServerAdmin webmaster#domain.com
DocumentRoot /var/www/domain.com/public_html/support/current
<Directory "/var/www/domain.com/public_html/support/current">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName domain.com
ServerAlias .domain.com
ServerAdmin webmaster#domain.com
DocumentRoot /var/www/domain.com/public_html/support/current
<Directory "/var/www/domain.com/public_html/support/current">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Either /var/www/domain.com/public_html/support/current doesn't exist, or its rights are not correct for user Apache runs on. Check the User and Group settings in the main Apache config to find out what they are.
You might also want to check the error log to get additional clues.

Apache The Requested URL has not been found on this server

So, I'm trying to get Codiad on my VPS so that me and a friend can work on a project together, and when I try to index localhost/codiad it gives me this error:
The requested URL /codiad was not found on this server.
however, indexing localhost works perfectly fine, it leads me to the normal apache screen. Here are the contents of my default.conf file, if that helps at all:
<VirtualHost *:80>
ServerName www.dsept.cf
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Alias /codiad /home/Tide/Codiad
<Directory "/home/Tide/Codiad">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
I'm also following this guide if that helps too: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-codiad-a-web-based-ide-on-an-ubuntu-vps, the directory of default.conf is /etc/apache2/sites-available/default.conf
1) are you sure there should be:
localhost/codiad
or :
localhost/Codiad
2) have you ever changed that .conf? If so, you may have to edit that .conf and add codiad alias/path correctly. Is everything accurate there?

Apache - url not found in some cases

I've got some problem with my Zend application uploaded on Ubuntu server. While such urls: http://www.domain.com, http://www.domain.com/admin/panel work, only this type of links: http://www.domain.com/index/51-picture.html show: Not found.The requested URL /index/51-picture.html was not found on this server.
Apache.conf
<Directory/>
Options FollowSymLinks
Allow from All
</Direcory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sites-available/domain.conf
<VirtualHost *:80>
ServerAdmin admin#domain.com
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/domain
<Directory /var/www/domain/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I've also enabled: a2enmod rewrite
Thanks for your help.
Ok, I've found the solution. Just removed MultiViews from domain configuration file. Now everything's fine.

2 domains pointing to 1 server (2 different subfolders)

OK, so, I think the title is rather self-explanatory.
I've set up my own Apache server (on Debian) and hosting 2 different sites (let's say mysite1.com at /home/www/mysite1, and mysite2.com at /home/www/mysite2).
In my domain name registrar setup page (Dynadot actually), I created A records (still not sure what this is exactly...) for both of them, pointing to my server's ip...
Now, on the server's side, here'e what my .conf file looks like (/etc/apache2/sites-enabled/mysite actually)
<VirtualHost *:80>
DocumentRoot /home/www/mysite1.com
ServerName www.mysite1.com
ServerAdmin drkameleon#gmail.com
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/www/mysite1.com>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin
<Directory "/home/www/mysite1.com/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot /home/www/phpmyadmin
ServerName www.mysite1.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/www/mysite2.com
ServerName www.mysite2.com
ServerAdmin drkameleon#gmail.com
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/www/mysite2.com>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Now, the thing is. Now matter which site I visit (1 or 2), I always get mysite1's contents.
What am I doing wrong? Any ideas?
There are multiple possibilities of what could go wrong.
Do you have
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
somewhere in the config? (http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost)
Without that config entry Apache is not sensitive to domain names in dispatching requests to virtual hosts.
It's just a guess.
Make sure Apache has been reloaded after any changes to the config!