LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-20-2018, 07:56 PM   #1
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Rep: Reputation: 22
Unhappy Centos7, Apache, subdomains and .conf-file configuration


Hi all.

system used:
Code:
 uname -a
Linux aaa.bbb 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I installed a server(I'm in a hurry again) about 1,5 weeks ago using CentOS 7 and after about 5 minutes of googling I found out the how .conf-files should be of a subdomain.
It all worked OK but later I did the thing a Linux Admin SHOULD NOT DO!!!!
Using runninglevel 3(as always) I changed to a directory, as I thought, but I wrote a little wrong so I happened to be in root-dir and there I did 'rm -rf'. I saw what happened so I CTRL-C it but as I knew, that system was gone.

Now I reinstalled it again but THIS time I just can not find the apache-subdomain-conf-file-example-thing and I just can't get it to work.
I've been doing this for 5 days now and still nothing works.

'DocumentRoot' is set to the directory of the main domain name.

As I can't recall at all how the conf-file looked like I gotta ask;

YES, I googled my a$$ of for this, this 2nd time and nothing works. Also tried different browsers on different devices and still nothing, so no cash problems

-?- Do I have to have the subdomain-directives in the same .conf-file as the 'main' domain as some google-result says? (tried that and it didn't work, if I did it correctly)

I probably have missed showing you info about the system but I don't know what to show.
It's a "normal" CentOS 7 installation and its' versions all the latest applications.

I'm about to give up even though I already got it working like 1 week ago.
 
Old 07-21-2018, 02:58 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Now I reinstalled it again but THIS time I just can not find the apache-subdomain-conf-file-example-thing and I just can't get it to work.
I've been doing this for 5 days now and still nothing works.

'DocumentRoot' is set to the directory of the main domain name.
<-snip->
-?- Do I have to have the subdomain-directives in the same .conf-file as the 'main' domain as some google-result says? (tried that and it didn't work, if I did it correctly)
To configure a vhost (or subdomain as you say it) for apache in Centos, read this howto (esp. #6).

If /etc/httpd/conf.d/vhost.conf does not exist, you can create it using the example in the link above as a template.
FYI apache reads all .conf files under /etc/httpd/conf.d at startup.
 
Old 07-21-2018, 06:11 AM   #3
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Original Poster
Rep: Reputation: 22
Well it's not a vhost I'm after. I want to add subdomains under domainname.com like

aaa.domainname.com, bbb.domainname.com, ccc.domainname.com etc
All other things with "normal" domainnames work perfectly just this thing with subdomains that won't work.
I own a real domainname and I want to add more other sites to it but by using the above subdomains.
 
Old 07-21-2018, 07:31 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Basher52 View Post
Well it's not a vhost I'm after. I want to add subdomains under domainname.com like

aaa.domainname.com, bbb.domainname.com, ccc.domainname.com etc
All other things with "normal" domainnames work perfectly just this thing with subdomains that won't work.
I own a real domainname and I want to add more other sites to it but by using the above subdomains.
Any subdomain is actually a vhost, so you should follow the same setup.
Or else, post the config that is not working and the error you get so we could help you better on that.
 
Old 07-21-2018, 10:16 AM   #5
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Original Poster
Rep: Reputation: 22
Well ain't that typical today it worked and I've been trying this for almost a week now.
I tried different types that I googled up and this is supposed to work and it does, like all subdomains in the same conf-file as where the main domain was, which ALSO works now.
Just can't figure out why it didn't work the other days. As I said, I flushed all browsers and tried on different PCs and mobile devices.

Ah well, it works so I'm glad

This is what I have now
Code:
<VirtualHost *:80>
    ServerName sub1.domain.com
    DocumentRoot /webdata1/sub1
    ErrorLog /var/log/httpd/sub1.domain.com-error.log
    CustomLog /var/log/httpd/sub1.domain.com-access.log combined
</VirtualHost>
I got four of these all in separate files under .../conf.d/
All of them works as subdomain under domain.com, like:
http://domain.com show one site, the main one.
and these;
http://dom1.domain.com
http://dom2.domain.com
http://dom3.domain.com
http://dom4.domain.com

all shows different sites

Marking this post solved
and thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect subdomains configuration under apache? ocupado Linux - Server 11 04-07-2012 04:56 PM
Need help of configuration of mod_ntlm.conf for Single Sign-on in apache/linux bromo Linux - Server 0 04-07-2011 03:36 AM
hosts conf. file - how to enable subdomains for testing? rotten_yellow Linux - Server 1 06-14-2008 11:48 PM
Please amend apache conf/httpd.conf file please payjoe Linux - Newbie 7 09-21-2007 05:12 PM
configuration of httpd.conf to run apache server adityabhat2 Linux - Newbie 2 02-13-2005 12:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration