virtual host in linux

erik_paka

New member
Aug 21, 2019
8
1
3
Below is my vhost file
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /home/websites/web-admin.bal.com

ServerName admin.bal.com
Serveralias *.admin.bal.com

ErrorLog /home/websites/logs/admin.bal.com-error_log
CustomLog /home/websites/logs/admin.bal.com-access_log combined
AccessFileName .htaccess
DirectoryIndex index.php index.html index.htm

<Directory /home/websites/web-admin.bal.com>
Order Allow,Deny
Allow from all
AllowOverride AuthConfig FileInfo Indexes Limit Options
Options +FollowSymLinks
DirectorySlash On
</Directory>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLogLevel 5
# RewriteLog "/home/websites/logs/admin.bal.com-rewrite_log"

RewriteCond %{HTTP_HOST} ^live.admin.bal.com$ [NC]
RewriteRule ^/(.*)$ http://admin.bal.com/$1 [NC,R,L]

RewriteCond %{HTTP_HOST} ^admin.bal.com$ [NC]
RewriteRule ^/(.*)$ /live/$1 [NC,L]

RewriteCond %{HTTP_HOST} ^(.*).admin.bal.com [NC]
# RewriteCond %{DOCUMENT_ROOT}/%1 !-d
RewriteCond %{DOCUMENT_ROOT}/%1 !-f
RewriteRule ^/(.*)$ http://admin.bal.com/$1 [NC,R,L]

RewriteCond %{HTTP_HOST} !^admin.bal.com$ [NC]
RewriteRule /robots.txt$ /home/websites/robots.txt [NC,L]

RewriteCond %{HTTP_HOST} ^(.*).admin.bal.com$ [NC]
RewriteRule ^/(.*)$ /%1/$1 [NC,L]

</IfModule>

<Files ~ "^\.(htaccess|htpasswd)$">
Order Deny,Allow
Deny from all
Satisfy All
</Files>
</VirtualHost>

But when I use safari to access admin.bal.com
I don't know why display Safari can't find the server
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu