Apache VirtualHost Setup on QNAP for Sub Sirectories - linux

I am trying to setup vHost on my QNAP web server (Running Apache). I seem to be stuck at the point where I can't load the subdomains. I have included a custom conf file in the apache.conf file like so:
include /share/Web/customapache.conf
In the customapache file, I have the following:
NameVirtualHost *:80
ServerName 127.0.0.1
DocumentRoot "/share/Web/site1-home"
<Directory />
Order deny,allow
Deny from all
</Directory>
ServerSignature Off
ServerTokens Prod
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
# ServerAlias www.localhost
DocumentRoot "/share/Web/site1-home"
<Directory "/share/Web/site1-home">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName pods.localhost
# ServerAlias www.pods.localhost
DocumentRoot "/share/Web/site2-pods"
<Directory "/share/Web/site2-pods">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
It's probably a bit of a mess as I have been trying multiple different examples trying to fix whatever issues I have. I am fairly new to linux, and apache to be honest. I was able to get it all working fine in NGINX, however I ran into some compatability issues with QNAP.
Essentially, the main redirect is working, so that the base directory is now /share/Web/site1-home, but the subdomain is not working (pods.localhost). I am sure its something simple I am missing, or even something I have added that I do not need. But any assistance, or even a point in the right direction would be much appreciated.
Regards
Kirt

Related

The site does not see the frontend

I'm trying to launch a website using apache2 through a remote server in the PuttY program. The site gives a 503 error. There are no errors in the logs. All necessary components for operation are installed.
Maybe I made a mistake in the code (although I wrote the backend in the same way and it works fine)
ServerName test.site.com
DocumentRoot /var/www/test/frontend/web/
DirectoryIndex index.php index.html index.htm index.shtml
<Directory /var/www/test/frontend/web/>
Options Indexes FollowSymLinks MultiViews
Options all
# AllowOverride controls what directives may be placed in .htac>
AllowOverride All
# Controls who can get stuff from this server file
#Order allow,deny
Allow from all
Require all granted
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
ErrorLog /${APACHE_LOG_DIR}/test.lan-error.log
CustomLog /${APACHE_LOG_DIR}/test.lan-access.log combined
</VirtualHost>```
[1]: https://i.stack.imgur.com/6stZG.png

LAMP vhost still points to www/html

I've created the following virtual host file in /etc/apache2/sites-available/lion.dev:
<VirtualHost *:80>
ServerAdmin webmaster#lion.dev
ServerName lion.dev
DocumentRoot /var/www/lion.dev
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/lion.dev/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
CustomLog /var/log/apache2/lion.dev/access.log combined
ErrorLog /var/log/apache2/lion.dev/error.log
</VirtualHost>
The problem is that it is actually pointing to the /www/html folder when I visit lion.dev in my browser.
What am I missing and why isn't this working?
Did you uncomment load virtual host in httpd.conf file?
That is usally commented and the module wont be loaded, just remove //before virtual host part.
My apologies I saw late that you resolved the issue.
I resolved the issue by uninstalling Ubuntu and re-installing Windows 10

Apache2 cgi-bin location not updating

First of all thanks for the help. I'm trying to port a website to a new version of linux (Raspian Jessie), and am having a few issues, apache2 is version 2.4.10. Mainly with getting the cgi-bin folder to update correctly. I've updated the default file in /etc/apache2/sites-available/ to reflect the location that I would like the directory to be, yet apache is still trying to use the old cgi-bin location, thus giving me a 404 when I try to view the page in a web browser. My current config is as follows:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>
The error log indicates that apache is still looking in the /usr/lib/cgi-bin/ directory for the cgi files and I can't seem to get it to update to the new location. Any thoughts.
You are not using "Include" correctly to load your VirtualHost file, therefore apachectl -S output does not show anything after "VirtualHost configuration:" and it goes on to the next section. There it should list your virtualhost and say it is the default as it is only one.
Review your Include directives

VirtualHost apache 2.2

some months ago I had apache 2.4 and I could create virtualhost, but now I had to change my apache version to 2.2 and my virtualhost is not working, I also have linux mint 17
my virtualhost file is the next: zendvirtual.conf
<VirtualHost *:80>
ServerAdmin roberth#zend
ServerName zend
ServerAlias zend
DocumentRoot /var/www/frameworks/zend/public
<Directory /var/www/frameworks/zend/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Someone knows if I have to add something more, a new line, another configuration?
The syntax:
Require all granted
is not supported under Apache 2.2. The equivalent is:
Allow from all

Error setting up multiple vhosts with Apache2 on Mint 15

I just installed Apache2 on mint 15. I am able to see the localhost and so decided to add virtual hosts for my projects.
I have added the hostnames at /etc/hosts
127.0.0.1 eclipse
I also added vhost details at /etc/apache2/site-avaliable:
<VirtualHost *:80>
ServerAdmin webmaster#eclipse
ServerName eclipse
ServerAlias www.eclipse
# Indexes+Document Root
DirectoryIndex index.html index.php
DocumentRoot /home/cygnus/Dropbox/Workspace_Eclipse
#logfiles
ErrorLog /var/log/apache2/eclipse-error.log
CustomLog /var/log/apache2/eclipse-access.log combined
<Directory /home/cygnus/Dropbox/Workspace_Eclipse>
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
</VirtualHost>
I activated the vhost using:
sudo a2ensite example.com
Also added following to /etc/apache2/httpd.conf
ServerName localhost
ServerName eclipse
After all the work I checked:
http://localhost - works OK.
http://eclipse - gives 403 error.
Do I need to do anything more to add vhost in linux? Did I miss or mess up some step?
Any help is appreciated - Thanks in advance :)
Update:
I tried changing the DocumentRoot to "/var/www/test/" - this works
but I need it to work at home level.
I used chown and chgrp to set owner and group to both www-data and root - neither worked.
It's probably the <Directory> container:
<Directory /home/cygnus/Dropbox/Workspace_Eclipse>
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
Are you sure your requests are actually coming from 127.0.0.1? What's the remote_addr IP that shows up in the logs? To verify, try removing the Deny from all line and see if you can access it.
Found my answer here
All I was missing was: chmod -R 755 /home/cygnus/Dropbox/*

Resources