LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-28-2016, 01:56 AM   #1
L a r r y
Member
 
Registered: Aug 2011
Distribution: Linux Mint 20.3 Cinnamon
Posts: 32

Rep: Reputation: Disabled
Red face apache2ctl, setup of envvar Linux Mint 17.3


I have run Apache2 in Windows, and had everything set up on my computer to host my website at localhost, everything works, and I can upload to my Linux-hosted Apache2 Web host. httpd.comf was in one file and I could even run Perl scripts both on Windows and Linux without change, simply bt having the Apache in Drive C: and Perl at G:\bin\perl.exe.

I installed Apache2 on Linux Mint, a refacing of Ubuntu, I run the bin file and Paache2 shows the Ubuntu "It works!" page. That page is in /var/www/html.

I moved the original It works page to /var/www to place my Web page in the html directory.

First off, Ubuntu "simplifies" things by placing different sections of httpd.conf in include files, such as ports.conf where I find the Listen directive. I have yet to find the DocumentRoot directive.

With further reading, I am not supposed to be running the bin file directly, but instead I am supposed to be running the apache2ctl script which generates child processes and makes use of environmental variables.

O have no envvar file and do not know what to put in one if I create it. Second, it took me by surprise when I found myself showing the "It works!" page instead of the site I had placed in the html directory. I had my site showing on localhost at this time while I iron out the bugs.

I called index.html a new name and then I found Apache showing me the index of / to include my renamed Index.html and the html directory that contains my website.

I see another post on here from another LQ user that wants to know how to set permissions. His website is in the /var/www directory. That fact and mine now being in the www is different from what the It works page says is Ubuntu's default place for the web root.

I am running just an html site for now, and it will be hosted on the local amateur radio wireless mesh network that now carries 7 users and growing, with no Internet access involved. We have an email server, chat room and VOIP telephone service.

I have experience with hosted websites on Apache on Linux, and have run Ubuntu 6.06 through 12.04 before I dumped it because of the new desktop, and have now gotten back in it with Linux Mint and the Mate desktop. I am quite familiar with .htaccess and am reacquainting myself with the command line.

I have never successfully set up a virtual host, instead working with global values in the httpd.comf to accomplish what I want to do in a local test server.

I have had my site online on the mesh, but I want to do things the right way.

Questions: What to put in the envvar file, where to find the DocumenntRoot directive and some tutorial help with setting up Apache for online service.

I learned HTML, SHTML.XHTML, CSS and Perl all from online tutorials and a lot of Google.

Thanks for your help.

Edit 1: I just performed a Google search for 'envvar" and find that "envvar is a tiny JavaScript package for deriving JavaScript values from environment variables," quoting fronm Google.

Edit 2: I found a tutorial on LinuxMint.com: https://community.linuxmint.com/tutorial/view/805
This may help me locate some of the different parts of apache2.conf that are broken into bits and pieces by Ubuntu.

Last edited by L a r r y; 04-29-2016 at 06:02 AM. Reason: Second edit, adding more information found by searching in LinuxMint.com
 
Old 04-30-2016, 06:06 AM   #2
L a r r y
Member
 
Registered: Aug 2011
Distribution: Linux Mint 20.3 Cinnamon
Posts: 32

Original Poster
Rep: Reputation: Disabled
I have sorted this much out:
I set my Listen directive in ports.conf to 127.0.0.1:8090. Doing that got me to serving a site at /var/www instead of /var/www/html.

I went to 000-enabled.conf, where I found a <virtualhost *:80>.

I made that
#<virtualhost *:80>
<virtualhost 127.0.0.1:8090>



Further in I found a line that I commented out to read
#ServerName www.example.com and I added:
ServerName localhost

Also within that <virtualhost> container, I saw a DocumentRoot specifying /var/www/html.
In the Terminal I issued these commands:

sudo apache2ctl stop
sudo apache2ctl start

I visited localhost:8090 in my Firefox and saw the website I am hosting at /var/www/html.
Obviously I was not seeing this because of the port mismatch between Listen 8090 and <virtualhost *:80>. That was when I was serving out of /var/www when I ran apache2ctl after having changed the port specified in Listen between the time I served the website with a direct call to apache2 and the time I served it from apache2ctl.

Now I have a question:

sudo apache2ctl start
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' globally to suppress this message.

Here are my current thoughts:

In order to serve the site at localhost:80, and serve it on the mesh at example.local.mesh:8090, I need to globally set a Listen 127.0.0.1:80
ServerName localhost
DocumentRoot /var/www/html

and set all of these values in my 000-default.conf as
<virtualhost 10.0.19.15:8090> ("10.0.19.15" is the IP address assigned to my computer)
Listen 10.0.19.15:8090
ServerName example.local.mesh
DocumentRoot /var/www/html

The global setting could be in ports.conf
The virtualhost setting could be in 000-default.conf

Then I could host a second site at example.2.local.mesh
Create a copy of 000-default.conf and give it a new name, include it in the apache2.conf
<virtualhost 10.0.18.15:8090>
Listen 10.0.19.15:8090
ServerName example.2.local.mesh
DocumentRoot /var/www/html2

If I am right on that part, I would also resolve this error with my global settings in ports.conf or apache2.conf:

apache2ctl start
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message.

Right now I am hosting my site on localhost:8090 by setting Listen 127.0.0.1:8090 and setting <virtualhost 127.0.0.1:8090 in 000-defaults.conf. I added the ServerName 'localhost' in the virtualhost container which already contains the DocumentRoot.

Having the DocumentRoot specified there, behind a <virtualhost *:80> with a .

Having the DocumentRoot specified there, behind a <virtualhost *:80> with a specified Listen on port 8090 resulted in my server giving me a /var/www DocumentRoot.

Now that I've written this up here, time to put it in play and see what happens.
 
Old 04-30-2016, 09:01 AM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by L a r r y View Post
Now I have a question:

sudo apache2ctl start
Could not reliably determine the server's fully qualified domain name
Set
Code:
ServerName localhost
in /etc/apache2/apache2.conf
Bounce and done.

Last edited by Habitual; 04-30-2016 at 09:02 AM.
 
1 members found this post helpful.
  


Reply

Tags
apache2



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
Scroll mouse setup in Linux Mint Jonnyc Linux - Newbie 2 02-16-2016 12:02 PM
Linux Mint - 3 Monitor Setup - 3rd Not working deadlySniper Linux - Desktop 4 06-12-2014 07:54 PM
Shell envvar question jdveencamp Linux - General 2 05-29-2014 10:53 AM
Linux Mint 10 Wireless Adapter Setup splap Linux - Newbie 2 03-30-2011 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03: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