problem subdomain debian server 9

New to Debian (Or Linux in general)? Ask your questions here!

problem subdomain debian server 9

Postby Vask0 » 2018-01-16 09:08

Hello I want to ask why I can not load a subdomain with this script..

this script

Code: Select all

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName tech.softinfo.org
    ServerAlias tech.softinfo.org
    DocumentRoot /var/www/tech
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>




this subdomain does not load a dir /var/www/tech
does any idea why it does not load the desired folder tech? but as you write tech.softinfo.org is loading my main directory softinfo.org (/var/www )
User avatar
Vask0
 
Posts: 2
Joined: 2018-01-16 08:55

Re: problem subdomain debian server 9

Postby pendrachken » 2018-01-17 01:11

Vask0 wrote:Hello I want to ask why I can not load a subdomain with this script..

this script

Code: Select all

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName tech.softinfo.org
    ServerAlias tech.softinfo.org
    DocumentRoot /var/www/tech
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>




this subdomain does not load a dir /var/www/tech
does any idea why it does not load the desired folder tech? but as you write tech.softinfo.org is loading my main directory softinfo.org (/var/www )



You forgot the quotes around the DocumentRoot path.

Code: Select all
DocumentRoot /var/www/tech


Should be:

Code: Select all
DocumentRoot "/var/www/tech"


It's been years since I used Apache, but I'm fairly sure that is your problem.

The other issue I can think of is if you created the directory you are pointing to without read permissions for group and others. I did this one time and it took me a while to figure out why I couldn't list the contents of the directory but could call a known file from it :oops:


EDIT: also check your DNS, make sure that when you added the subdomain you still have it pointing to both your server IP AND port 80. Also make sure your DNS server isn't just redirecting your subdomain query back to your main domain.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1310
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: problem subdomain debian server 9

Postby p.H » 2018-01-17 16:20

pendrachken wrote:also check your DNS, make sure that when you added the subdomain you still have it pointing to both your server IP AND port 80

The only DNS record type I know which points to a port is SRV. AFAIK it is not used much for websites, most websites use A and/or AAAA records which only point to an IPv4 or IPv6 address respectively.
p.H
 
Posts: 220
Joined: 2017-09-17 07:12

Re: problem subdomain debian server 9

Postby pendrachken » 2018-01-17 18:48

It depends on the host, some provide redirect servers right through the DNS control interface so that you don't have to set anything else up yourself. It's all done backend and invisible to the user who just has to check a box and specify the forwarded port number.

I've also used some shady DNS hosts before that when calling a subdomain that isn't in an A list, but IS part of a domain that does have an A listing will just forward the address to the main domain instead of throwing an error. Cheap crappy hosting will often do this, or at least they used to. Maybe ICANN has been cracking down harder recently.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1310
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: problem subdomain debian server 9

Postby Vask0 » 2018-01-19 09:25

In that case, how do I transfer DNS (ip) to load a folder www/var/tech the ip address is the same as the root directory?

what command I need to run in the terminal and which file I need to edit..?

again mention that I use Webmin...

10x
User avatar
Vask0
 
Posts: 2
Joined: 2018-01-16 08:55

Re: problem subdomain debian server 9

Postby pendrachken » 2018-01-19 17:26

Assuming you have the subdomain set up in DNS, if it points to your main site yet Apache isn't set up properly for your subdomain. Check your config files for the virtual server again for any typing errors.


Also Apache MUST be reloaded after modifying the Apache sites available files and virtualservers. Make sure you have restarted Apachee however your host requires you to restart the service.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1310
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable