Why does apache always redirect to the default VirtualHost?WebDAV on CentOS - getting 403 error when attempt to uploadApache Virtual Hosts Not Workinghttpd (13) Permission denied: access to / deniedSub-domain setup doesn't work Apache 2.2.26 on Amazon EC2Can't access apache by port 80 from externalDefault documentroot served from url localhostapache reading wrong virtualhost confApache serve specific documentroot on IP:PORTApache 2.4 using default DocumentRoot instead of VirtualHost DocumentRootApache Start Fails due to missing mpm module

What does this line mean in Zelazny's The Courts of Chaos?

When a class dynamically allocates itself at constructor, why does stack overflow happen instead of std::bad_alloc?

Purpose of cylindrical attachments on Power Transmission towers

The best in flight meal option for those suffering from reflux

ISP is not hashing the password I log in with online. Should I take any action?

Must I use my personal social media account for work?

Is it true that "only photographers care about noise"?

Is it advisable to add a location heads-up when a scene changes in a novel?

In The Incredibles 2, why does Screenslaver's name use a pun on something that doesn't exist in the 1950s pastiche?

What is Gilligan's full name?

Undocumented incompatibility between changes and siunitx?

Must CPU have a GPU if motherboard provides display port (when no separate video card)?

Is it a good security practice to force employees hide their employer to avoid being targeted?

Forgot passport for Alaska cruise (Anchorage to Vancouver)

Realistic, logical way for men with medieval-era weaponry to compete with much larger and physically stronger foes

What's the difference between DHCP and NAT? Are they mutually exclusive?

Part of my house is inexplicably gone

In Pandemic, why take the extra step of eradicating a disease after you've cured it?

Why does there seem to be an extreme lack of public trashcans in Taiwan?

Does WiFi affect the quality of images downloaded from the internet?

Is it possible to have battery technology that can't be duplicated?

Am I being scammed by a sugar daddy?

Is this Homebrew Eldritch Invocation, Accursed Memory, balanced?

Are athlete's college degrees discounted by employers and graduate school admissions?



Why does apache always redirect to the default VirtualHost?


WebDAV on CentOS - getting 403 error when attempt to uploadApache Virtual Hosts Not Workinghttpd (13) Permission denied: access to / deniedSub-domain setup doesn't work Apache 2.2.26 on Amazon EC2Can't access apache by port 80 from externalDefault documentroot served from url localhostapache reading wrong virtualhost confApache serve specific documentroot on IP:PORTApache 2.4 using default DocumentRoot instead of VirtualHost DocumentRootApache Start Fails due to missing mpm module






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Im using apache 2.4 on centOS7.6 and I want to have one subdomain and the main domain, both showing different content. I have two VirtualHosts configured, both in different files in /etc/httpd/conf.d/



example.com.conf



<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/example.com/
</VirtualHost>


and subdomain.example.com.conf



<VirtualHost *:80>
ServerName subdomain.example.com
DocumentRoot /var/www/html/subdomain.example.com/
</VirtualHost>


The problem is, no matter which domain i go to, i get the file from the default VirtualHost, which is the alphabetically first one. I tried changing the permissions of /var/www/ to 777, disabling selinux, switching the os to fedora30 and a few minor things.



main httpd.conf:



ServerRoot "/etc/httpd"

Listen 80

Include conf.modules.d/*.conf

ServerAdmin webmaster@example.com

<Directory />
AllowOverride none
Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>

LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %v" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %I %O" combinedio
</IfModule>

CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on
Include conf.d/*.conf









share|improve this question
























  • You dis restart Apache httpd after creating those files? And depending on how the main Apache httpd.conf loads include snippets (look for the Include and IncludeOptional directives) your configuration snippets may need to have the .conf suffix

    – HBruijn
    May 28 at 21:12







  • 1





    the file needs to end with .conf, otherwise apache wont load its content. so based on your example, the file should be called subdomain.example.com.conf

    – Diego Velez
    May 28 at 21:14












  • Yes i did restart Apache and it is called subdomain.example.com.conf i just forgot to add that in the post, as for the main httpd conf, ill add that to the post shortly

    – ZofiaZementa
    May 28 at 21:18











  • Just added it now

    – ZofiaZementa
    May 28 at 21:27











  • Do your logs show anything?

    – Tommiie
    Jun 4 at 12:25

















0















Im using apache 2.4 on centOS7.6 and I want to have one subdomain and the main domain, both showing different content. I have two VirtualHosts configured, both in different files in /etc/httpd/conf.d/



example.com.conf



<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/example.com/
</VirtualHost>


and subdomain.example.com.conf



<VirtualHost *:80>
ServerName subdomain.example.com
DocumentRoot /var/www/html/subdomain.example.com/
</VirtualHost>


The problem is, no matter which domain i go to, i get the file from the default VirtualHost, which is the alphabetically first one. I tried changing the permissions of /var/www/ to 777, disabling selinux, switching the os to fedora30 and a few minor things.



main httpd.conf:



ServerRoot "/etc/httpd"

Listen 80

Include conf.modules.d/*.conf

ServerAdmin webmaster@example.com

<Directory />
AllowOverride none
Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>

LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %v" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %I %O" combinedio
</IfModule>

CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on
Include conf.d/*.conf









share|improve this question
























  • You dis restart Apache httpd after creating those files? And depending on how the main Apache httpd.conf loads include snippets (look for the Include and IncludeOptional directives) your configuration snippets may need to have the .conf suffix

    – HBruijn
    May 28 at 21:12







  • 1





    the file needs to end with .conf, otherwise apache wont load its content. so based on your example, the file should be called subdomain.example.com.conf

    – Diego Velez
    May 28 at 21:14












  • Yes i did restart Apache and it is called subdomain.example.com.conf i just forgot to add that in the post, as for the main httpd conf, ill add that to the post shortly

    – ZofiaZementa
    May 28 at 21:18











  • Just added it now

    – ZofiaZementa
    May 28 at 21:27











  • Do your logs show anything?

    – Tommiie
    Jun 4 at 12:25













0












0








0








Im using apache 2.4 on centOS7.6 and I want to have one subdomain and the main domain, both showing different content. I have two VirtualHosts configured, both in different files in /etc/httpd/conf.d/



example.com.conf



<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/example.com/
</VirtualHost>


and subdomain.example.com.conf



<VirtualHost *:80>
ServerName subdomain.example.com
DocumentRoot /var/www/html/subdomain.example.com/
</VirtualHost>


The problem is, no matter which domain i go to, i get the file from the default VirtualHost, which is the alphabetically first one. I tried changing the permissions of /var/www/ to 777, disabling selinux, switching the os to fedora30 and a few minor things.



main httpd.conf:



ServerRoot "/etc/httpd"

Listen 80

Include conf.modules.d/*.conf

ServerAdmin webmaster@example.com

<Directory />
AllowOverride none
Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>

LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %v" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %I %O" combinedio
</IfModule>

CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on
Include conf.d/*.conf









share|improve this question
















Im using apache 2.4 on centOS7.6 and I want to have one subdomain and the main domain, both showing different content. I have two VirtualHosts configured, both in different files in /etc/httpd/conf.d/



example.com.conf



<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/example.com/
</VirtualHost>


and subdomain.example.com.conf



<VirtualHost *:80>
ServerName subdomain.example.com
DocumentRoot /var/www/html/subdomain.example.com/
</VirtualHost>


The problem is, no matter which domain i go to, i get the file from the default VirtualHost, which is the alphabetically first one. I tried changing the permissions of /var/www/ to 777, disabling selinux, switching the os to fedora30 and a few minor things.



main httpd.conf:



ServerRoot "/etc/httpd"

Listen 80

Include conf.modules.d/*.conf

ServerAdmin webmaster@example.com

<Directory />
AllowOverride none
Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>

LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %v" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %I %O" combinedio
</IfModule>

CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on
Include conf.d/*.conf






linux centos apache-2.4 centos7 apache2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 28 at 21:26







ZofiaZementa

















asked May 28 at 20:49









ZofiaZementaZofiaZementa

11




11












  • You dis restart Apache httpd after creating those files? And depending on how the main Apache httpd.conf loads include snippets (look for the Include and IncludeOptional directives) your configuration snippets may need to have the .conf suffix

    – HBruijn
    May 28 at 21:12







  • 1





    the file needs to end with .conf, otherwise apache wont load its content. so based on your example, the file should be called subdomain.example.com.conf

    – Diego Velez
    May 28 at 21:14












  • Yes i did restart Apache and it is called subdomain.example.com.conf i just forgot to add that in the post, as for the main httpd conf, ill add that to the post shortly

    – ZofiaZementa
    May 28 at 21:18











  • Just added it now

    – ZofiaZementa
    May 28 at 21:27











  • Do your logs show anything?

    – Tommiie
    Jun 4 at 12:25

















  • You dis restart Apache httpd after creating those files? And depending on how the main Apache httpd.conf loads include snippets (look for the Include and IncludeOptional directives) your configuration snippets may need to have the .conf suffix

    – HBruijn
    May 28 at 21:12







  • 1





    the file needs to end with .conf, otherwise apache wont load its content. so based on your example, the file should be called subdomain.example.com.conf

    – Diego Velez
    May 28 at 21:14












  • Yes i did restart Apache and it is called subdomain.example.com.conf i just forgot to add that in the post, as for the main httpd conf, ill add that to the post shortly

    – ZofiaZementa
    May 28 at 21:18











  • Just added it now

    – ZofiaZementa
    May 28 at 21:27











  • Do your logs show anything?

    – Tommiie
    Jun 4 at 12:25
















You dis restart Apache httpd after creating those files? And depending on how the main Apache httpd.conf loads include snippets (look for the Include and IncludeOptional directives) your configuration snippets may need to have the .conf suffix

– HBruijn
May 28 at 21:12






You dis restart Apache httpd after creating those files? And depending on how the main Apache httpd.conf loads include snippets (look for the Include and IncludeOptional directives) your configuration snippets may need to have the .conf suffix

– HBruijn
May 28 at 21:12





1




1





the file needs to end with .conf, otherwise apache wont load its content. so based on your example, the file should be called subdomain.example.com.conf

– Diego Velez
May 28 at 21:14






the file needs to end with .conf, otherwise apache wont load its content. so based on your example, the file should be called subdomain.example.com.conf

– Diego Velez
May 28 at 21:14














Yes i did restart Apache and it is called subdomain.example.com.conf i just forgot to add that in the post, as for the main httpd conf, ill add that to the post shortly

– ZofiaZementa
May 28 at 21:18





Yes i did restart Apache and it is called subdomain.example.com.conf i just forgot to add that in the post, as for the main httpd conf, ill add that to the post shortly

– ZofiaZementa
May 28 at 21:18













Just added it now

– ZofiaZementa
May 28 at 21:27





Just added it now

– ZofiaZementa
May 28 at 21:27













Do your logs show anything?

– Tommiie
Jun 4 at 12:25





Do your logs show anything?

– Tommiie
Jun 4 at 12:25










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f969225%2fwhy-does-apache-always-redirect-to-the-default-virtualhost%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f969225%2fwhy-does-apache-always-redirect-to-the-default-virtualhost%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos