Page: Previous  1, 2, 3, 4  Next

techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Good, if you used no tools to setup apache2 then the issue is solvable.

It looks to me like the first place to check is if your
apache2.conf
file is properly loading the /etc/apache2/envvars file.

Don't discount the possibility that the debian install is also defective, as I noted, this stuff can all change apache/debian version to version, though once installed, the changes usually are not that major in the configuration file, I haven't had any actual problems for years, I think 4 years ago or so was the last time I had to change anything in my apache configs.

/var/lock is a dynamic directory, it creates lockfiles, you don't touch that, it's just telling apache where it is.

I believe though I'm not certain that I worked around issues like this by simply adding in the paths, though I'm not certain.

It's clear that your apache2.conf is not getting the right paths. I'm looking at the config file that debian left as uninstalled which is the default one, and it has no paths set, and requires the loading of envvar file to function.

Looking at my two versions it's obvious that apache / debian switched from hard coded paths in apache2.conf to globals, but I can't see where envvars is loaded.

Ok, my information is out of date (after reading up on it).

askubuntu.com/questions/146688/why-doesnt-apache2-respect-my-envvars-file

This is quite good.

If you use: apache2ctl start
it will load the envvar file automatically, as well, or should, service apache2 start

:: Quote ::
0 down vote


From httpd.apache.org/docs/2.2/configuring.html

The values of shell environment variables can be used in configuration file lines using the syntax ${ENVVAR}. If "ENVVAR" is the name of a valid environment variable, the value of that variable is substituted into that spot in the configuration file line, and processing continues as if that text were found directly in the configuration file. (If the ENVVAR variable is not found, the characters "${ENVVAR}" are left unchanged for use by later stages in the config file processing.)

So, the variable is indeed retrieved from the environment as expected. Now where does this happen?

In /etc/init.d/apache2, APACHE_ENVVARS is set to the path of the envvars file which is based on the initscript path. It usually results in APACHE_ENVVARS=/etc/apache2/envvars being set. Now, since this value equals to the default values as set in apache2ctl, it is not exported.

From /usr/sbin/apache2ctl:

# the path to the environment variable file
test -z "$APACHE_ENVVARS" && APACHE_ENVVARS="$APACHE_CONFDIR/envvars"
# pick up any necessary environment variables
if test -f $APACHE_ENVVARS; then
. $APACHE_ENVVARS
fi

Explanation: if APACHE_ENVVARS is empty, use the default path which is /etc/apache2/envvars. If this file exists, "source" it (execute the commands from that file in the current environment).

Be sure that the envvars file does not contain any syntax errors. To perform such a check, use:

sh -n /etc/apache2/envvars && echo Syntax OK || echo FAIL

Errors are printed if any.


I'm using an older method and have without realizing it adjusted my system to the use of that method, though normally I start apache2 as a service anyway but whenever I restart it I have been using apache2 -k restart which because I removed the use of globals in my configuration file works fine, in my case, lol. But not yours.

So I took you on a slightly off chase, so let's see how it does when you start it with:
apache2ctl start

That should load the right paths at least, then we can move to the next step.

I'm very lazy when it comes to learning new configuration stuff, I dislike change, so I avoid it if I can, I believe I avoided it here for example.
for now
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Reading the /usr/sbin/apache2ctl file, which is a text script, it loads the globals first, then does this:

:: Code ::

case $ARGV in
start)
    mkdir -p ${APACHE_RUN_DIR:-/var/run/apache2}
    mkdir_chown ${APACHE_RUN_USER:-www-data} ${APACHE_LOCK_DIR:-/var/lock/apache2}
    # ssl_scache shouldn't be here if we're just starting up.
    # (this is bad if there are several apache2 instances running)
    rm -f ${APACHE_RUN_DIR:-/var/run/apache2}/*ssl_scache*
    $HTTPD ${APACHE_ARGUMENTS} -k $ARGV
    ERROR=$?
    ;;
stop|graceful-stop)
    $HTTPD ${APACHE_ARGUMENTS} -k $ARGV
    ERROR=$?
    ;;
restart|graceful)
    if $HTTPD ${APACHE_ARGUMENTS} -t 2> /dev/null ; then
        $HTTPD ${APACHE_ARGUMENTS} -k $ARGV
    else
        $HTTPD ${APACHE_ARGUMENTS} -t
    fi
    ERROR=$?
    ;;


as you may note, this translates to:
do some early startup stuff then run
$HTTPD ${APACHE_ARGUMENTS} -k $ARGV
or: apache2 -k start
for example.

/etc/init.d/apache2
has about the same stuff in it.

The problem is this is going to turn off some visible error reporting, but you can get that from /var/log/apache2/error.log

to find the actual start errors.

This was a useful refresher for me in terms of current basic debian / apache2 setup, I literally have not set up a debian apache server for I think 5 years now, and only mildly debugged one instance after an update, probably to fix the failure to load the envvar because I was using apache2 -k start without the proper use of either:

apache2ctl start/restart/stop
or
service apache2 start/restart/stop

there's very little difference, if any, between these two methods, but the use of apache2 -k restart alone if you use debian with apache globals in envvars is wrong in current apache2 stuff, sorry about that, my info was / is out of date.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 292
Location: South Florida
Reply Quote
This is my apache2.conf file, please note the new Mutex file on line 74.
:: Code ::

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#   /etc/apache2/
#   |-- apache2.conf
#   |   `--  ports.conf
#   |-- mods-enabled
#   |   |-- *.load
#   |   `-- *.conf
#   |-- conf-enabled
#   |   `-- *.conf
#    `-- sites-enabled
#       `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
   Options FollowSymLinks
   AllowOverride None
   Require all denied
</Directory>

<Directory /usr/share>
   AllowOverride None
   Require all granted
</Directory>

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

#<Directory /srv/>
#   Options Indexes FollowSymLinks
#   AllowOverride None
#   Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
   Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
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

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Sorry for the long post.
Output of command:
:: Code ::

root@papimalo:/home/ckosloff# sh -n /etc/apache2 envvars && echo Syntax OK || echo FAIL
Syntax OK

so we are good there.
However...
:: Code ::

root@papimalo:/home/ckosloff# service apache2 restart
[ ok ] Restarting web server: apache2.
root@papimalo:/home/ckosloff# apache2 --help
[Fri Sep 13 20:57:00.377677 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Fri Sep 13 20:57:00.378413 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Fri Sep 13 20:57:00.378725 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Fri Sep 13 20:57:00.379107 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Fri Sep 13 20:57:00.379381 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_LOG_DIR} is not defined   
[Fri Sep 13 20:57:00.483563 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_LOG_DIR} is not defined   
[Fri Sep 13 20:57:00.485417 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_LOG_DIR} is not defined   
[Fri Sep 13 20:57:00.485906 2013] [core:warn] [pid 11196] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

Back to the error on the Mutex file.
Also tried this:
:: Code ::

root@papimalo:/home/ckosloff# apache2ctl start
httpd (pid 2271) already running

to be expected.
The error that is blocking me from setting up virtual hosting is still there, for apache dumbsite does not exist, it does not see it.
:: Code ::

root@papimalo:/home/ckosloff# apache2ctl -S
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server papimalo.POMPANO (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost papimalo.POMPANO (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost papimalo.POMPANO (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: MODPERL2
User: name="www-data" id=33
Group: name="www-data" id=33
User: name="www-data" id=33
Group: name="www-data" id=33

Maybe this can shed some light because namevhost is not localhost but papimalo.POMPANO, the second line in my /etc/hosts.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 292
Location: South Florida
Reply Quote
:: Code ::

[Fri Sep 13 12:11:22.015054 2013] [mpm_prefork:notice] [pid 2243] AH00171: Graceful restart requested, doing restart
[Fri Sep 13 12:11:22.247967 2013] [:notice] [pid 2243] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[Fri Sep 13 12:11:22.248029 2013] [:notice] [pid 2243] mod_python: using mutex_directory /tmp
[Fri Sep 13 12:11:22.265045 2013] [mpm_prefork:notice] [pid 2243] AH00163: Apache/2.4.6 (Debian) PHP/5.5.3-1 mod_python/3.3.1 Python/2.7.5+ mod_perl/2.0.8 Perl/v5.18.1 configured -- resuming normal operations
[Fri Sep 13 12:11:22.265089 2013] [core:notice] [pid 2243] AH00094: Command line: '/usr/sbin/apache2'
[Fri Sep 13 13:57:12.439593 2013] [mpm_prefork:notice] [pid 2243] AH00169: caught SIGTERM, shutting down
[Fri Sep 13 15:29:26.438307 2013] [:notice] [pid 2271] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[Fri Sep 13 15:29:26.499329 2013] [:notice] [pid 2271] mod_python: using mutex_directory /tmp
[Fri Sep 13 15:29:28.414547 2013] [mpm_prefork:notice] [pid 2271] AH00163: Apache/2.4.6 (Debian) PHP/5.5.3-1 mod_python/3.3.1 Python/2.7.5+ mod_perl/2.0.8 Perl/v5.18.1 configured -- resuming normal operations
[Fri Sep 13 15:29:28.414714 2013] [core:notice] [pid 2271] AH00094: Command line: '/usr/sbin/apache2'
[Fri Sep 13 20:56:47.755614 2013] [mpm_prefork:notice] [pid 2271] AH00169: caught SIGTERM, shutting down
[Fri Sep 13 20:56:48.876855 2013] [:notice] [pid 11168] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[Fri Sep 13 20:56:48.876982 2013] [:notice] [pid 11168] mod_python: using mutex_directory /tmp
[Fri Sep 13 20:56:49.320039 2013] [mpm_prefork:notice] [pid 11168] AH00163: Apache/2.4.6 (Debian) PHP/5.5.3-1 mod_python/3.3.1 Python/2.7.5+ mod_perl/2.0.8 Perl/v5.18.1 configured -- resuming normal operations
[Fri Sep 13 20:56:49.320182 2013] [core:notice] [pid 11168] AH00094: Command line: '/usr/sbin/apache2'

This comes from my apache2 error log.
I already filed bug on this mutex stuff.
Will give it a rest for now and continue tomorrow.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
once you have the first errors, stop all thinking and don't even mention later errors, like dumbsite not existing/loading.

Do:

service apache2 stop

then do

apachectl start

and check for errors.

You're still getting the failed load of the envvars file, you don't need to think at all once you see that error, if that fails, everything will fail so it's irrelevant to note that everything after it is failing, that's a given, as I already indicated.

Config variable ${APACHE_LOG_DIR} is not defined
means the envvars file did not load.

However, apache did not object when it was started.

I don't believe apache2 --help is an actual command that has any meaning, though it may be an easy way to trigger the error output so it's as good as anything else. When in doubt, use: man apache2 and see what the actual options are. When using real unix tools like apache, read the man pages, they are written to be read.

But do what I said, you don't need to post more stuff, open your apache log files and read them, that will show what happens on start, that's the var/log file I noted above.

There's almost certainly something wrong in your setup but what it is is hard to say.

From the man page, we learn about this one:
:: Code ::
apache2 -t
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
-t tests syntax of files, ie, an actual code syntax error. You are NOT getting an actual syntax error, what you are getting is a syntax error CAUSED by the lack of the environmental global apache variables, caused by apache2 failing to load the file in the first place on start. There is no other problem for you at this point.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
If nothing else works, do this:

:: Code ::

service apache2 stop
apache2ctl stop
source /etc/apache2/envvars && apache2 -k restart


What this is going to do is basically force the load of envvars, though I'm not positive it will stick into the apache configs, it should, that's basically a shortened form of what apachectl does.

If it gives errors on trying to source/load the envvars file, that's your problem.

Also show:

ls -l /etc/apache2

which will show the permissions on all the files.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I missed your last posting, too much data so it's hard to follow it.

What is the 127.0.1.1 for, where did that come from that's non standard.

In /etc/hosts

what put that there?

Your localhost is 127.0.0.1 so anything else is coming from somewhere and you need to know where that somewhere is. i have never seen 127.0.1.1 used ever before, with the exception of your hosts file contents.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
please do not file real bug reports on issues like this, it's just junk for the maintainer to have to spend time on, there is almost certainly no debian bug involved in my opinion.

You should always assume you are doing something wrong until you have enough knowledge / experience to actually determine that something is a bug in fact. Particulary with apache2 and networking, in general, assume it's your mistake until you can prove it isn't.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
"Maybe this can shed some light because namevhost is not localhost but papimalo.POMPANO, the second line in my /etc/hosts."

why? get rid of that, immediately, stop trying to run before you can walk.

Do not touch anything in /etc/hosts except for adding the dumbsite thing, the more stuff you make complicated the more you can break, get the base install working before trying any fancy stuff, it makes support virtually impossible.

Get rid of the 127.0.1.1 item, don't try to be fancy or anything, apache2 is hard to learn don't make it impossible.

You are making this very difficult to help you with.

Here's your setup, don't deviate from it:

127.0.0.1 localhost dumbsite

Explain in extremely specific terms why you did this, and where: namevhost is not localhost but papimalo.POMPANO'

If you do not know why you did it, then get rid of it immediately and create a system that is not deviating from normal practices, remember, you have almost no idea how this stuff works, so don't try to make it fancier, that's just asking for failure and headache, and nobody can help you because nobody would ever think to do certain things, thus would never hit that problem, thus has no way to help you.

Apache2 is very difficult to learn, it's a professional tool, I believe you did something, possibly this, that breaks it, and of course then it won't work, that's not a bug, that's an error.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 292
Location: South Florida
Reply Quote
Just one thing before I go to sleep.
This is my /etc/hosts:
:: Code ::

127.0.0.1   localhost dumbsite
127.0.1.1   papimalo.POMPANO   papimalo

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

The only thing I added is dumbsite after localhost.
The second line came with the apache install, I did not add it.
So when apache says that namevhost is the second line, that is how it works now.
I think that is why I don't see the irrelevant error: "Could not determine reliable server name, using 127.0.0.1 instead".
See you tomorrow.
Back to top
Display posts from previous:   
Page: Previous  1, 2, 3, 4  Next
All times are GMT - 8 Hours