i have tried creating the virtual hosts via this following link
Digital Ocean Virtual Host
However it is using only first vhost settings. i have tried many tutorials but nothing is working.
Finally i have put the vhost settings in httpd.conf file
Listen 8000
<VirtualHost *:80>
ServerName abc.edu
ServerAlias www.abc.edu
DocumentRoot /var/www/html/abc/frontend/dist
<Directory /var/www/html/abc/frontend/dist>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:8000>
ServerName apiabc.edu
ServerAlias www.apiabc.edu
Alias /static /var/www/html/abc/abc/static
<Directory /var/www/html/abc/abc/static>
Require all granted
</Directory>
<Directory /var/www/html/abc/abc/abc>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess abc python-path=/var/www/html/abc/abc python-home=/var/www/html/abc/env
WSGIProcessGroup abc
WSGIScriptAlias / /var/www/html/abc/abc/abc/wsgi.py
</VirtualHost>
Related
I am trying to set up two virtual hosts for one IP address say xxx.yy.xxx.yyy
I have my files on /var/www/html/folder1 and /var/www/html/folder2
I am adding VH like :
DocumentRoot /var/www/html/folder1
ServerName xxx.yy.xxx.yyy/folder1
AllowOverride All
DocumentRoot /var/www/html/folder12
ServerName xxx.yy.xxx.yyy/folder2
AllowOverride All
As I am new on CentOS7 Apache, can't figure out how to solve it.
I do not know if I can be helpful but I locally configure so apace to have multiple domains
<VirtualHost q4y.aurecchia.dev:80>
DocumentRoot "C:\xampp\htdocs\QuestManager\AurQuest4You\public"
ServerAdmin q4y.aurecchia.dev
<Directory "C:\xampp\htdocs\QuestManager\AurQuest4You">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost csm.aurecchia.loc:80>
DocumentRoot "C:\xampp\htdocs\CSM TEST\Aur_CSM\public"
ServerAdmin csm.aurecchia.loc
<Directory "C:\xampp\htdocs\CSM TEST\Aur_CSM">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I clone project in /home/ivan/host/name/web and create virtual host. a2ensite and reload and restart server.
<VirtualHost *:80>
ServerName name.local
DocumentRoot /home/ivan/host/name/web
DirectoryIndex app.php
ErrorLog /var/log/apache2/name-error.log
CustomLog /var/log/apache2/name-access.log combined
<Directory "/home/ivan/host/name/web">
AllowOverride All
Allow from All
</Directory>
and hosts
127.0.0.1 name.local
but have
Forbidden
You don't have permission to access / on this server.
I doing chmod 777 -R host/ but still have error
what I'am doing wrong ?
SOLVED
<VirtualHost *:80>
ServerName aog.local
DocumentRoot /home/ivan/host/name/web
DirectoryIndex app.php
ErrorLog /var/log/apache2/name-error.log
CustomLog /var/log/apache2/name-access.log combined
<Directory "/home/ivan/host/name/web">
AllowOverride All
Require all granted
Allow from All
</Directory>
Look like you are using apache 2.4,
add directive Require all granted as shown below:
<Directory /home/ivan/host/name/web>
AllowOverride All
Options +FollowSymlinks
Require all granted
</Directory>
I'm using a Linux Server for my website www.domain.com
I want to create the subdomain www.test.domain.com for a test environment.
I started configuring the vhost-file.
<Directory /var/www/domain/>
AllowOverride None
Order Deny, Allow
Deny from all
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/domain/
ServerName domain.com
ServerAlias domain.com
ServerAlias www.domain.com
ServerAdmin support#domain.com
ErrorLog /var/ww/domain/
<IfModule mod_ssl.c>
</IfModule>
<Directory /var/www/domain/
Options FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
</Directory>
How can I edit the Vhost file for the subdomain www.test.domain.com in directory ,,/var/www/test/"?
A Sub-Domain is actually a separate domain. You will need to create a new VHost for Sub-Domain.
<Directory /var/www/test/>
AllowOverride None
Order Deny, Allow
Deny from all
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/test/
ServerName test.domain.com
ServerAlias testdomain.com
ServerAlias www.test.domain.com
ServerAdmin support#test.domain.com
ErrorLog /var/ww/test/
<IfModule mod_ssl.c>
</IfModule>
<Directory /var/www/test/
Options FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
</Directory>
You can set all your parameters as you like, separately for Sub-Domain.
I install XAMPP(OS : win 7 ) in D drive. Document root is D:/xampp/htdocs
When I open localhost/xampp/ then it open . No problem
I create virtual host zf2.local as bellow and it's working fine.
<VirtualHost zf2.local:80>
ServerAdmin webmaster#localhost
DocumentRoot "D:/xampp/htdocs/WORK/zend/public"
ServerName zf2.local
</VirtualHost>
But when I configure like bellow then it's show forbiden
<VirtualHost zf2.local:80>
ServerAdmin webmaster#localhost
DocumentRoot "D:/WORK/zend/public"
ServerName zf2.local
</VirtualHost>
Actually I want to set document root outside the htdocs & both should work means localhost as well as virtual host. please help me.
<VirtualHost *>
ServerAdmin admin#localhost.com
DocumentRoot "C:/xampp/htdocs" # change this line with your htdocs folder
ServerName localhost
ServerAlias localhost
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Read this article for further help
This should solve your problem:
<Directory "D:/WORK/zend/public">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>
OR
<Directory "D:/WORK/zend/public">
Allow from all
Require all granted
</Directory>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/"
ServerName localhost
<Directory "C:/xampp/htdocs/">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/gl"
ServerName gl.dev
<Directory "C:/xampp/htdocs/gl">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
The above is what I currently have in my vhosts file. When I hit localhost I want my root to open, but when I load gl.dev I want the individual site to open. Any ideas?
hosts file:
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 gl.dev
I think in windows you have to use backslash when specifying document root. please try the following
<VirtualHost *:80>
ServerName localhost
ServerAlias *.localhost
DocumentRoot "C:\xampp\htdocs\"
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName gl.dev
ServerAlias *.gl.dev
DocumentRoot "C:\xampp\htdocs\gl"
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Restart WAMP server