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 01-02-2021, 09:37 PM   #31
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by computersavvy View Post
1. Have you been looking at the logs in /var/log/httpd to see what they might tell you? Properly set up there should be separate logs for each aliased web site. Reading the logs should educate you on what is actually happening.

2. Have you tried disabling the virtual hosts (aliases) and confirmed that everything with the main host web pages is working correctly?

Once that is confirmed then
3. Enable one of the aliases and make certain it is properly configured and serving the right pages, including that it reaches the proper data and returns the proper identification to the asking page.

finally,
4. Once you have worked out the issues with one of the aliases you will have an idea of what to do with the second aliased web pages.

Every task needs completed one step at a time and task 1 is getting the main server site fully functional. Tasks need completed one at a time in sequence as well
computersavvy,

I'm getting 0 (zero) errors in the error logs since I cleared the errors that were showing external to the error logs, when Apache was not starting.

I'm attaching in all the files I think are pertainent:

Quote:
File /etc/fstab: Autoloads the 3T drive.
***********************************************************************
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation

#device mountpoint fstype options dump fsck
/dev/sda1 / ext4 errors=remount-ro 0 1
/dev/sdb1 /3T ext4 defaults 0 1
/swapfile none swap sw 0 0

***********************************************************************
Quote:
File /etc/hosts
***********************************************************************
127.0.0.1 localhost
127.0.1.1 TBNK-SVR.com
192.168.0.102 projects.com
***********************************************************************
Quote:
File /etc/apache2/apache2.conf
***********************************************************************
# Global configuration
#
ServerRoot "/etc/apache2"
DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /3T/Syncs/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /3T/Syncs/Projects/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined
LogFormat "%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
# IncludeOptional sites-enabled/*.conf
***********************************************************************
Quote:
File /etc/apache2/sites-available/000-default.conf
***********************************************************************
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory/>
Options FollowSymLinks
AllowOverride None
</Directory/>
<Directory /3T/Syncs/Projects/Web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory/>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory/>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory/>
<Location />
Deny from all
Options None
ErrorDocument 403 Forbidden.
</Location>
</VirtualHost>

<VirtualHost *:80>
ServerName projects.com
DocumentRoot /3T/Syncs/Projects/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
ServerName TBNK-SVR.com
DocumentRoot /3T/Syncs/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
***********************************************************************
Quote:
File /etc/apache2/sites-available/projects.com.conf
***********************************************************************
<VirtualHost *:80>
ServerAdmin admin@projects.com
ServerName projects.com
ServerAlias www.projects.com
DocumentRoot /3T/Syncs/Projects/
<Directory/>
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /3T/Syncs/Projects/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
***********************************************************************
Quote:
File /etc/apache2/sites-available/TBNK-SVR.com.conf
***********************************************************************
<VirtualHost *:80>
ServerAdmin admin@tbnk-sver.com
DocumentRoot /3T/Syncs/
<Directory/>
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /3T/Syncs/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
***********************************************************************
If I'm missing file here let me know. Trying to provide all needed files.

Now I'm at my wits end on this and get tired of the gurus dissing me because I don't have the concepts down yet.

Cheers!

TBNK

Last edited by TBotNik; 01-02-2021 at 09:38 PM.
 
Old 01-03-2021, 05:15 AM   #32
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I came here from the other thread you opened (and found I had been here before).

First, please use [code]...[/code] instead of [quote]...[/quote] to format code. Your config files are very hard to read right now.

I understand that this is your problem: You set up several name-based virtual hosts such as projects.com and TBNK-SVR.com, and when you access them from your web browser, you always get the default index.html file rather than the expected index file in the virtual server's document root. Correct?

Early observations:
If you are running Apache 2.4, you should use new authorization clauses (although the old ones still work).
There are two VirtualHost definitions that match projects.com. I don't know how Apache handles that.
The VirtualHost definition in the TBNK-SVR.com.conf config file has no ServerName clause.
The trailing slash in the end clause </Directory/> causes an error in my version of Apache (2.4.37 running on Centos 8).

Suggestions:
I would temporarily do away with the complexities of the TBNK-SVR.com.conf and projects.com.conf files and only use 000-default.conf for troubleshooting. I would also configure separate log files for each virtual host, so that you see which VirtualHost clauses the server uses.

Last edited by berndbausch; 01-03-2021 at 05:44 AM. Reason: Added text on new authorization clauses
 
1 members found this post helpful.
Old 01-03-2021, 05:58 AM   #33
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
@All: please consider post #5.

In addition to that, the OP has an unpleasant habit of bumping their own threads after long periods, instead of taking to heart & putting into practice what was suggested earlier.

Last edited by ondoho; 01-03-2021 at 05:59 AM.
 
Old 01-03-2021, 03:16 PM   #34
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by TBotNik View Post
All,

The gurus on the #httpd channel at irc.freenode.net point me to all the Apache docs but I cannot find a single item/article on defining a virtual host outside of /var/www and 100% of my websites and projects are on my 2nd 3TB HD, defined in fstab as /3T/ to autoload on bootup.

I know it is possible because 100% of hosting servers at the hosting houses use typically over 6 drives including RAID arrays, and have most of the accounts on these extra drives.

Sure wish I could find these answers! All help appreciated!

TBNK
The docs are not "on your system do this", but require you to read and understand the concept then make changes in the given examples so they apply to your specific system.

For security apache normally prevents access to any location outside the /var/www directory tree. If you mount the 3T volume at some location under /var/www (such as /var/www/html/3T) then the web server can be given access. by proper configuration of ServerName, DocumentRoot, Listen, and the appropriate Directory sections within the config files.

For ease of management each alias config file should be in /etc/apache2/conf-includes.d (or whereever the "include dirname" statement at the very end of the main /etc/apache2/apache2.conf file points). Putting everything in one file risks messing everything up with a change meant for one of the aliases.
 
Old 01-03-2021, 03:19 PM   #35
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
BTW, reading your config files you seem to be trying to give the webserver access to your entire system.
 
Old 01-07-2021, 11:09 AM   #36
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
berndbausch,

Quote:
From you:

I understand that this is your problem: You set up several name-based virtual hosts such as projects.com and TBNK-SVR.com, and when you access them from your web browser, you always get the default index.html file rather than the expected index file in the virtual server's document root. Correct?
Yes Correct!

Quote:
Again from you:

The VirtualHost definition in the TBNK-SVR.com.conf config file has no ServerName clause.
The trailing slash in the end clause </Directory/> causes an error in my version of Apache
Thanks! Had not realized I forgot both ServerName and ServerAlias in that file.

I was getting errors on my system that made me put in the trailing slash! Funny how different Apache is from Linux flavor to flavor!

Cheers!

TBNK
 
Old 01-07-2021, 11:14 AM   #37
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
computersavvy,

So if I change my fstab definition for my 3TB drive from "/3T" to "/var/www/3T" or "/var/www/html/3T" then my problems should end?

Never thought of that! Had always used aliases and had always used those outside of /var/www, so was perplexed when Apache was not seeing the 3TB drive.

Cheers!

TBNK
 
Old 01-07-2021, 06:46 PM   #38
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
computersavvy,

Well tried that and can't work as everything but Apache is looking for /3T. Guessing that maybe a symlink to put the projects dir under /var/www might work.

What do you think?

Cheers!

TBNK
 
Old 01-07-2021, 07:20 PM   #39
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by TBotNik View Post
computersavvy,

Well tried that and can't work as everything but Apache is looking for /3T. Guessing that maybe a symlink to put the projects dir under /var/www might work.

What do you think?

Cheers!

TBNK
This is why you do not change the main config file after it is properly working and put those definitions for the aliases in separate .conf files in the included directory.

Your version of apache is much older than mine but I have these lines as the vary last lines in the main httpd.conf file.(bolding is mine). Yours will have something similar and they point to a directory on the same level as the conf directory. For me that is /etc/httpd/conf and /etc/httpd/conf.d.
Code:
 # Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf
The reason for that is the main .conf file (for me /etc/httpd/conf/httpd.conf) is where you have the primary site config and it seldom gets changed. Once you have it working then the alias configs don't interfere. It is easy to make an error if you are trying to do it all in one file (as you currently are) and mess things up as you just did.
When you add an alias you put the conf file for it in (for me) /etc/httpd/conf.d. As you can see that config is loaded after all the main configs and that way something you put there does not screw up the main config. It adds additional config that is specialized for the alias only.

Last edited by computersavvy; 01-07-2021 at 07:24 PM.
 
Old 01-12-2021, 01:07 PM   #40
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Error Free vs Errors

computersavvy,

When I have the last line in my apache2.conf file:
Code:
#IncludeOptional sites-enabled/*.conf
commented out I run error free, but the virtual hosts are declared in that directory, so when I remove the comment"
Code:
IncludeOptional sites-enabled/*.conf
I get all the following errors from:
Code:
systemctl status apache2.service
journalctl -xe
Errors:
***********************************************************************
Exceeded text allowance here so moved to PB at:
https://pastebin.com/Tysnaxgw
***********************************************************************

I see no errors from the projects.com virtual host and all errors appear to be from the TBNK-SVR virtual host, but being so many, don't know where to start, but going to rename that .conf file and see where I'm at!

So renamed TBNK-SVR.com.conf to TBNK-SVR.com.bak and restarted Apache which ran error free, but still the projects.com is pointing to the localhost index.html page. If I can just fix that, I should know how to resolve the TBNK-SVR.com issues.

Cheers!

TBNK
 
Old 01-12-2021, 01:14 PM   #41
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
computersavvy,

So since projects.com was error free, copied projects.com.conf to TBNK-SVR.com.conf, edited the DocRoot and <Directory> entries, restarted Apache and now both error free, but still pointing to the localhost index.html file.

Cheers!

TBNK
 
Old 01-12-2021, 06:17 PM   #42
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by TBotNik View Post
computersavvy,

When I have the last line in my apache2.conf file:
Code:
#IncludeOptional sites-enabled/*.conf
commented out I run error free, but the virtual hosts are declared in that directory, so when I remove the comment"
So that tells you one or more of the .conf files in that directory have errors.

Rename all but one of them to something else, such as alias1.conf.save so apache will ignore them, then fix the problems in that remaining one .conf file. Then move on to the next and do the same. One step at a time. Trying to do more than one at a time leaves you wondering which is the error.

You need to first address the directory declaration that tells the server where the home for projects.com is located.

You also MUST have a discrete IP address and hostname assigned for each host alias as well as having the .conf file declare the host name and address to listen on for connections. If the server cannot identify the host alias it is listening for it will only serve the primary pages.

The errors you posted for apache explicitly give you the file and line number for the errors and the required fix. For example
Code:
Jan 12 12:12:41 TBNK-SVR apachectl[2391]: apache2: Syntax error on line 52 of /etc/apache2/apache2.conf: Syntax error on line 7 of /etc/apache2/sites-enabled/000-default.conf: Expected </Directory/> but saw </Directory>
Jan 12 12:12:41 TBNK-SVR apachectl[2391]: Action 'start' failed.
Jan 12 12:12:41 TBNK-SVR apachectl[2391]: The Apache error log may have more information.
It also tells you the apache log may have more info. That log should be under /var/log.

Then
Code:
Jan 12 00:09:39 TBNK-SVR apachectl[26496]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.0.102. Set the 'ServerName' directive globally to suppress this message

AND

Jan 12 11:27:38 TBNK-SVR apachectl[1464]: apache2: Syntax error on line 52 of /etc/apache2/apache2.conf: Syntax error on line 13 of /etc/apache2/sites-enabled/000-default.conf: Expected </Directory> but saw </Directory/>

AND

Jan 12 11:27:41 TBNK-SVR apachectl[1476]: apache2: Syntax error on line 52 of /etc/apache2/apache2.conf: Syntax error on line 13 of /etc/apache2/sites-enabled/000-default.conf: Expected </Directory> but saw </Directory/>
Do you see the common theme of those errors. They are telling you exactly what to fix.

Last edited by computersavvy; 01-12-2021 at 06:43 PM.
 
Old 01-13-2021, 08:32 AM   #43
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
All,

Later ran into more errors, but now getting more of the concept and so was able to work off those errors and now error free, but the 2 virtual hosts are still pointing the localhost (/var/www) index.html file, though I created unique index.html files for each docroot.

Oh yes: Half of the problem with me was not knowing what I was reading or seeing with the error reports, so when I finally got that straight in my mind, the debugging got much easier!

So the Q remains: How do I actually get these to point to the right directories?

Yes I understand that the hosting apps like "Control Panel" do this automatically, but I don't have those apps installed. Thanks!

Cheers!

TBNK

Last edited by TBotNik; 01-13-2021 at 08:57 AM.
 
Old 01-13-2021, 10:38 AM   #44
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
So now, having the unique index.html files is good. The .conf file for that alias has to point to that exact directory path as the root for that aliased server.

You have not said what you have done as far as making certain a connection to that aliased server knows it receives a connection that should be sent to that alias instead of the main server.

I have mentioned repeatedly that in order for the server to know a connection should be sent to the alias it needs both a server name FQDN and IP in the request.
For example the host requesting the info should address request to the main site as http://host.domain and requests to the alias should go to http://alias.domain.
The receiving server should then be able to identify which directory path is the root for the requested data. That is also set up in the *.conf file for each site.

The network config needs to have for example, 192.168.0.111 for the main server and 192.168.0.112 for the alias with either dns or the /etc/hosts file tying the IP to the FQDN for each server.
The appropriate *.conf file then sets the listen to the proper IP and the ServerName to the FQDN for the alias.
All this is needed for the apache server to be able to properly direct the incoming requests.
(Note: Although the different IPs are not 100% required, config is much easier with each alias having its own IP.)

Last edited by computersavvy; 01-13-2021 at 10:43 AM.
 
Old 01-16-2021, 12:38 AM   #45
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
computersavvy,

Since I'm still mostly confused, do you have examples, so I can try to understand?

Oh! Neither phpmyadmin nor php on cmd line were working, so I re-installed phpmyadmin, but it is still not working, but php cmd line started working after that. Pretty important as I do over 90% of my development in either BASH or PHP, mostly PHP.

I think somehow that phpmyadmin is not properly loading it's .conf file, so tried finding an old backup copy and moved it to /etc/apache2/conf-available, since it was missing, but that did not fix it, so still trying to figure why it is not working.

TBNK

Last edited by TBotNik; 01-16-2021 at 10:10 AM.
 
  


Reply

Tags
aliases, apache, configuration



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
bash script to display alias commands and un-alias any less than 12 characters bani Linux - Newbie 5 01-19-2014 12:34 PM
LXer: alias.sh puts your Linux shell alias on the clouds LXer Syndicated Linux News 0 01-21-2013 12:00 AM
Wildcard email alias in /etc/alias file custangro Linux - Enterprise 1 10-02-2009 12:17 PM
IP alias? Machine name alias? JohnLocke Linux - Newbie 4 01-16-2008 12:21 PM
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 12:40 AM

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

All times are GMT -5. The time now is 02:20 AM.

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