why apache force me to use https? - apache

i have a problem with apache2 on localhost
i have many virtualhost and thats worked fine before, but today i have a problem
when i try open test-bot.app apache force me to https://test-web.app!
this is my vhost file:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName test-bot.app
ServerAlias test-bot.app
DocumentRoot /var/www/html/test-bot/public
<Directory />
AllowOverride All
</Directory>
<Directory /var/www/html/test-bot/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/apache2/test-bot.app-error.log
LogLevel error
CustomLog /var/log/apache2/test-bot.app-access.log combined
</VirtualHost>
what can i do?

Related

you don't have permission to access / on this server. apache 2.4

I'm having the problem
you don't have permission to access / on this server. apache 2.4
while accessing my local web site. I already googled a lot and read a lot of posts here in StackOverflow and everything seems to be correct.
This is my apache version:
Server version: Apache/2.4.27 (Unix)
Attached my httpd.conf file.
Here is my httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin webmaster#localhost.smatchme.com
DocumentRoot "/Users/samuelrabini/Project/SmatchMe/smatchme.web"
ServerName localhost.smatchme.com
<Directory /Users/samuelrabini/Project/SmatchMe/smatchme.web>
Require all granted
Options Includes FollowSymLinks
AllowOverride All
</Directory>
DirectoryIndex index.php
ErrorLog "/private/var/log/apache2/localhost.smatchme.com-error_log"
CustomLog "/private/var/log/apache2/localhost.smatchme.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost.piuproduct.com
DocumentRoot "/Library/WebServer/Documents/piuproduct/public"
ServerName localhost.piuproduct.com
<Directory /Library/WebServer/Documents/piuproduct>
Require all granted
Options Includes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog "/private/var/log/apache2/localhost.piuproduct.com-error_log"
CustomLog "/private/var/log/apache2/localhost.piuproduct.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost.b2b.com
DocumentRoot "/Library/WebServer/Documents/b2b.tony"
ServerName localhost.b2b.com
<Directory /Library/WebServer/Documents/b2b.tony>
AllowOverride All
Require all granted
</Directory>
ErrorLog "/private/var/log/apache2/localhost.b2b.com-error_log"
CustomLog "/private/var/log/apache2/localhost.b2b.com-access_log" common
</VirtualHost>
Can anyone help me understand what I'm doing wrong?
I'm trying to access my site via http://localhost.b2b.com/
And I added in the /etc/hosts the entry:
127.0.0.1 localhost.b2b.com
thanks in advance
Samuel

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.

XAMPP Windows Apache vhosts not redirecting properly

<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

Apache vhost not working for subdomains

I have this configuration but both url app.test.com & stage.test.com
redirect to same code/deployment
<VirtualHost *:80>
ServerName app.test.com
DocumentRoot /var/www/html/Test-Prod/web
<Directory "/var/www/html/Test-Prod/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-prod__error_log
CustomLog logs/test-prod_access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName stage.test.com
DocumentRoot /var/www/html/Test/web
<Directory "/var/www/html/Test/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-website_error_log
CustomLog logs/test-website_access_log common
</VirtualHost>
The usual error for this is leaving out the NameVirtualHost directive if you're still using httpd 2.2
Add the following in your config file and it'll probably work
NameVirtualHost *.80
You might want to read the documentation for Named-based Virtual Host Support with httpd 2.2.
NameVirtualHost *.80
<VirtualHost localhost:80>
ServerName color
ServerAlias localhost
ServerPath "C:/wamp/www/subwww/color"
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www/subwww/color">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
in above code, subdomain name is color
and the url is http://color.localhost/
if the operating system is windows then add "127.0.0.1 color.localhost" in "C:/windows/system32/dirvers/etc/hosts" with notepad run as administration

Apache2 Dynamic vHost with multiple ServerAlias

I am trying to set up a dynamic vHost, but have run into some trouble. It will not allow me to set multiple ServerAlias.
<VirtualHost *:80>
ServerAlias *.com
ServerAdmin michael.ian.curry#gmail.com
VirtualDocumentRoot /var/www/%1/production/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
LogLevel warn
</VirtualHost>
The above vHost only works for '.com' i need it to work for 'www..com' and '*.com'
I assumed that setting the ServerAlias to would fix it, but it is not working.
ServerAlias *.com www.*.com
If you have any insight, please respond
--MichaelCurry
==EDIT 1==
Example redcrusher.com and www.redcrusher.com
==EDIT 2==
The code below does not work either
ServerAlias www.*.com *.com
Figured it out!
'www.*.com' must execute before '*.com' This is because ServerAlias is setting a dynamic domain and must exist before a "smaller" alias exists.
Example: 'www.*.com', 'dev.*.com', 'asdf.*.com' THEN '*.com'
vHost File [production.conf]:
<VirtualHost *:80>
ServerAlias www.*.com
VirtualDocumentRoot /var/www/%2/production/html
ServerAdmin michael.ian.curry#gmail.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
LogLevel warn
</VirtualHost>
<VirtualHost *:80>
ServerAlias *.com
VirtualDocumentRoot /var/www/%1/production/html
ServerAdmin michael.ian.curry#gmail.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
LogLevel warn
</VirtualHost>
I hope this helps anyone else that is having this problem!
--MichaelCurry
you must use like this
ServerAlias www.domain.com domain.com
ServerAlias *.domain.com
if You want use That Way You Must Follow Order
ServerAlias www.*.com *.com
the problem is of
VirtualDocumentRoot /var/www/%1/production/html
you Use a Dynamic VirtualDocumentRoot that mean
for redcrusher.com VirtualDocumentRoot is
/var/www/redcrusher/production/html
and for www.redcrusher.com VirtualDocumentRoot is
/var/www/www.redcrusher/production/html
I think with split ServerAlias in Three part it solve
ServerAlias www.*.com
VirtualDocumentRoot /var/www/%1/production/html/
ServerAlias *.*.com
VirtualDocumentRoot /var/www/%2/production/html/%1
ServerAlias *.com
VirtualDocumentRoot /var/www/%1/production/html
i think should Work
VirtualDocumentRoot :
redcrusher.com
/var/www/redcrusher/production/html
www.redcrusher.com
/var/www/redcrusher/production/html/
sub.redcrusher.com
/var/www/redcrusher/production/html/sub