Page: 1, 2, 3, 4  Next

Back to configuring virtual hosts [SOLVED]
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
I have a funny issue after I sent this computer to jessie.
I used to configure virtual hosts effortlessly, after killing myself to get it right.
Now, I think that I completed all the steps, however I am getting error.
This is /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


This is the dumbsite in /etc/apache2/sites-available:
:: Code ::

<VirtualHost *:80>
   
   ServerName dumbsite
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/dumbsite
   
   <Directory /var/www/dumbsite>

       Options All               
       AllowOverride All
       Order allow,deny
       Allow from all
   
   </Directory>
   
   
   DirectoryIndex index.html

</VirtualHost>


In /var/www there is a folder dumbsite with a stupid html file based on the default index.html for localhost.
It works if I type localhost/dumbsite so the folder is there.
However I get following error in console:
:: Code ::

root@papimalo:/home/ckosloff# service apache2 restart
[ ok ] Restarting web server: apache2.
root@papimalo:/home/ckosloff# a2ensite dumbsite
ERROR: Site dumbsite does not exist!
root@papimalo:/home/ckosloff#


What am I missing?

< Edited by ckosloff :: Sep 16, 13, 8:12 >

Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
I am not sure that I am missing something.
I opened terminal as root at /etc/apache2/sites-available
then
:: Code ::

ln -s dumbsite /etc/apache2/sites-enabled/dumbsite


and it worked!
So, why was a2ensite command throwing error?
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
spoke too soon.
ln -s creates the link but virtual hosting still not working.
typing dumbsite in address bar only serves the default index.html not the one inside dumbsite.
I t kills me that I cannot find the error.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3786
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
if you type 'localhost' you should see the default apache page, usually.

As you found, you need sites enabled link to the sites available file.

Since you have allowoverride all switched on, any .htaccess file will override anything in your apache config;

there's so many places an error can occur it's hard to say, you should read all the files for config you have, open them all up in an editor and verify that all paths etc are correct.

I always use apache2 -k restart to restart the server.

Any change to the apache setup requires an apache restart, of course, or it won't see it, it only reads the configs at startup.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
:: techAdmin wrote ::

I always use apache2 -k restart to restart the server.

We are making some progress.
Here is output of command:
:: Code ::

root@papimalo:/home/ckosloff# apache2 -k restart
[Fri Sep 13 08:52:59.951495 2013] [core:warn] [pid 4796] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Fri Sep 13 08:52:59.952079 2013] [core:warn] [pid 4796] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Fri Sep 13 08:52:59.952382 2013] [core:warn] [pid 4796] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Fri Sep 13 08:52:59.952895 2013] [core:warn] [pid 4796] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Fri Sep 13 08:52:59.953161 2013] [core:warn] [pid 4796] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Sep 13 08:53:00.024162 2013] [core:warn] [pid 4796] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Sep 13 08:53:00.024945 2013] [core:warn] [pid 4796] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Sep 13 08:53:00.025074 2013] [core:warn] [pid 4796] 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}


And here are lines 72~74.
:: Code ::

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

Of course, I did not change anything in apache2.conf.
This ${APACHE_LOCK_DIR} is new, nothing like that was happening before.
The ln -s command worked and created the symlink, however that symlink was not working, it would not give access to the file not even to root, however access was granted to the default config files.
Output of command will explain things better.
:: Code ::

root@papimalo:/etc/apache2/sites-available# a2ensite
Your choices are: 000-default default-ssl
Which site(s) do you want to enable (wildcards ok)?

As you see although dumbsite is there, it is not an option.
It all stems from this new LOCK_DIR cr#p, but I don't know how to fix.
BTW, I have asked on #httpd on freenode but they are very anal.
Thanks for answer.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
#httpd does not know where the variables in the new apache2.conf come from, they don't troubleshoot Debian.
I think I have to submit bug, it doesn't make sense to get syntax errors on brand new install.
Maybe I'll switch to nginx, heard great praise of it.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3786
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
It's not that #apache is anal, it's that they are generally professionals who are only interested in professional level issues, not basic configuration file errors. I never ask sources like that for help unless I have already learned enough to actually avoid basic mistakes.

You're skipping around here, and of course, will not have any success until you stop and fix the errors one by one.

The syntax error is caused by the first error, which is the globals not getting set in apache.

apache on start has two kinds of errors, one is a simple alert, like not having certain dns things etc running, another is an actual error in the syntax, any syntax error will kill all the next steps, so there's exactly zero point in proceeding until you fix the basic stuff.

I'm not clear on how you setup things, or how the errors happened, but I can tell you that I avoid at all costs using tools to do trivial things like linking symbolically things.

If you read through the main config file, you will see that certain things are loaded based on the global paths, so if the global is unset, then of course none of the paths will work, including sites_enabled and sites_available.

Remember, apache is professional software, it requires work to learn what hte stuff does, and how to do it correctly, and you have to have at least a faint working knowledge of the steps it takes to load all of itself when it starts, the error messages you got were quite accurate and tell you everything you need to know, which is that your globals are not loading due to some error somewhere.

The default debian install is going to vary apache version to version, one of the downsides to running debian is that I never reinstall debian, just upgrading the same install year after year, and have only updated apache I think 1 or 2 times in terms of debugging configurations things in the last 8 years, give or take, on my local systems, ie, it just works, unless the core configs change a bit, which they did fairly fundamentally when apache introduced that range of globals, I'm honestly surprised that the default debian install didn't have all those basics running, I suspect you may have accidentally done something wrong with a config file somewhere.

Again, read the actual config file, top to bottom, see where it attempts to load each thing, then open that thing to see what data is contained in it, go step by step until you reach the last steps, which is the loading of the global path + sites_enabled folder.

Here's a sample of a correct start, showing one irrelevant alert:
:: Code ::
#apache2 -k restart
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3786
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
In case you're not clear:

:: Code ::
grep -Rsn APACHE_LOCK_DIR /etc/apache2
/etc/apache2/apache2.conf.dpkg-dist:89:LockFile ${APACHE_LOCK_DIR}/accept.lock
/etc/apache2/envvars:20:export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
/etc/apache2/mods-available/dav_fs.conf:1:DAVLockDB ${APACHE_LOCK_DIR}/DAVLock


So you read tat, and exclude the dpkg thing since that's something from debian itself, then you note: /etc/apache2/envvars:20:export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX

so the /etc/apache2/envvars is where that variable is set, so that file is clearly not loading, or is incorrectly setup.

Support people like #apache won't help someone in general who doesn't do the basics of debugging (ie, starting apache right, which you learn by reading the directions, for example), it's just a time waster and isn't very fun. Generally when dealing with serious support, you have to demonstrate that you have given it an educated best effort, done the basics, etc, and that there is some actual issue that has to be fixed that is hard to figure out. the old apache support forums I used to use for example did not allow any configuration questions that did not include tested/debugged working code that could be studied and solved if wrong. for example, I never asked anything there until I had given the problem at least 4 to 8 hours of time, and that was a specific issue related to usually mod rewrite, which is very hard to learn.

I'm assuming you did not use any garbage like easyapache or lamp etc to set this apache up, if you did, I won't help you, nor will anyone else who runs or supports apache because those things are just junk that makes everything worse, not better, and are not supportable by anyone other than the people who make them, and even they tend to not know what the heck they are doing.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
:: techAdmin wrote ::

I'm assuming you did not use any garbage like easyapache or lamp etc.

The only thing I used is smxi, never edited a config file.
Will go through these steps and be back here, I cannot figure out how a clean install can get all those errors.
I understand it is better not to reinstall, that's why I intend to be always in testing, but it was the only way to get rid of video bugs.
Now I have this other problem and I really need to fix it.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
My configuration is different than what you posted:
:: Code ::

root@papimalo:/home/ckosloff# grep -Rsn APACHE_LOCK_DIR /etc/apache2
/etc/apache2/apache2.conf:74:Mutex file:${APACHE_LOCK_DIR} default
/etc/apache2/envvars:21:export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
/etc/apache2/mods-available/ssl.conf:51:        #Mutex file:${APACHE_LOCK_DIR}/ssl_mutex ssl-cache
/etc/apache2/mods-available/dav_fs.conf:1:DAVLockDB ${APACHE_LOCK_DIR}/DAVLock

There is this Mutex file.
Here is my envvars:
:: Code ::

# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
   SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
   SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''

## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1

This file I never touched, and I don't want to do that with some expert guidance, so please let me know what I am supposed to do with it.
Please note line 21 of envvars:
:: Code ::

export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX

it is uncommented however directory /var/lock/apache2 is empty, view hidden files enabled.
Thank you.
Back to top
Display posts from previous:   
Page: 1, 2, 3, 4  Next
All times are GMT - 8 Hours