PDA

View Full Version : Apache 2.4 Problems



carnold6
18-Jan-2015, 02:14
Apache 2.4 on sles 12. I understand this version is way different from 2.2 but I can't get 2.4 to even listen on 80 or 443. Can anyone help me with this? The logs only shows me when I start and stop Apache. Btw, I am using apache2ctl stop/start as rcapache2 doesn't seem to stop/start and etc/init.d/apache2 stop/start is not even in that path........

Here is my httpd.conf:

# run under this user/group id
Include /etc/apache2/uid.conf

# - how many server processes to start (server pool regulation)
# - usage of KeepAlive
Include /etc/apache2/server-tuning.conf

ErrorLog /var/log/apache2/error_log

# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf

# IP addresses / ports to listen on
Include /etc/apache2/listen.conf

# predefined logging formats
Include /etc/apache2/mod_log_config.conf

# generated from global settings in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/global.conf

# optional mod_status, mod_info
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf

Include /etc/apache2/mod_reqtimeout.conf

# optional cookie-based user tracking
# read the documentation before using it!!
Include /etc/apache2/mod_usertrack.conf

# configuration of server-generated directory listings
Include /etc/apache2/mod_autoindex-defaults.conf

# associate MIME types with filename extensions
TypesConfig /etc/apache2/mime.types
Include /etc/apache2/mod_mime-defaults.conf

# set up (customizable) error responses
Include /etc/apache2/errors.conf

# global (server-wide) SSL configuration, that is not specific to
# any virtual host
Include /etc/apache2/ssl-global.conf

# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
# See /usr/share/doc/packages/apache2/README-access_compat.txt
<IfModule mod_access_compat.c>
Order deny,allow
Deny from all
</IfModule>
<IfModule !mod_access_compat.c>
Require all denied
</IfModule>
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
# See /usr/share/doc/packages/apache2/README-access_compat.txt
<IfModule mod_access_compat.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule !mod_access_compat.c>
Require all granted
</IfModule>
</Files>

# List of resources to look for when the client requests a directory
DirectoryIndex index.html index.html.var index.php

Include /etc/apache2/default-server.conf


# Another way to include your own files
#
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
# APACHE_CONF_INCLUDE_DIRS
Include /etc/apache2/sysconfig.d/include.conf

IncludeOptional /etc/apache2/vhosts.d/*.conf

Here is the listen.conf:

Listen 80


<IfDefine SSL>
<IfDefine !NOSSL>
<IfModule mod_ssl.c>

Listen 443

</IfModule>
</IfDefine>
</IfDefine>

Here is a vhost conf:

<VirtualHost *:80>
ServerAdmin email@domain.tld
ServerName domain.tld
ServerAlias www.domain.tld

DocumentRoot /srv/www/htdocs/sites/domain

# if not specified, the global error log is used
ErrorLog /var/log/apache2/teknerds.net-error_log
CustomLog /var/log/apache2/teknerds.net-access_log combined

# don't loose time with IP address lookups
HostnameLookups Off

# needed for named virtual hosts
UseCanonicalName Off

# configures the footer on server-generated documents
ServerSignature On

ScriptAlias /cgi-bin/ "/srv/www/vhosts/dummy-host.example.com/cgi-bin/"

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have one, and where ScriptAlias points to.
#
<Directory "/srv/www/vhosts/dummy-host.example.com/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
<IfModule mod_access_compat.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule !mod_access_compat.c>
Require all granted
</IfModule>
</Directory>


#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/srv/www/htdocs/sites/domain">

Options Indexes FollowSymLinks

AllowOverride None

# See /usr/share/doc/packages/apache2/README-access_compat.txt
<IfModule mod_access_compat.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule !mod_access_compat.c>
Require all granted
</IfModule>


</Directory>

The error from chrome is connection rejected. Netstat -nlp does not show listening on 80 or 443. I have a phpinfo.php file on the doc root, a html file on the doc root and a website in the above location; can not get to any of these places

ab
18-Jan-2015, 02:48
What do you have in the various log files, particularly the error logs?

ErrorLog /var/log/apache2/teknerds.net-error_log
ErrorLog /var/log/apache2/error_log

--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...

carnold6
18-Jan-2015, 03:01
What do you have in the various log files, particularly the error logs?

ErrorLog /var/log/apache2/teknerds.net-error_log
ErrorLog /var/log/apache2/error_log

There is absolutely 0 in their in regards to trying make a connection. 0 in the access/error.log; only shows where I stop and start, that's it.

ab
18-Jan-2015, 04:32
I think SLE 12 is using systemd; have you tried the systemd equivalent to
start the service? I'm guessing it is something like this:



sudo systemctl start apache2.service



--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...

carnold6
19-Jan-2015, 03:45
I think SLE 12 is using systemd; have you tried the systemd equivalent to
start the service? I'm guessing it is something like this:



sudo systemctl start apache2.service


I restarted the server and now i get at least a 403 and netstat shows port 80 but not 443 and php downloads instead of showing page. How do you get 443 running? Any ideas? Modules are loaded. SSL Vhost is present. See above for listen.conf

smflood
19-Jan-2015, 14:47
On 19/01/2015 02:54, carnold6 wrote:

> I restarted the server and now i get at least a 403 and netstat shows
> port 80 but not 443 and php downloads instead of showing page. How do
> you get 443 running? Any ideas? Modules are loaded. SSL Vhost is
> present. See above for listen.conf

Did you notice those IfDefine directives around the Listen 443 line in
listen.conf? Those tell Apache to listen on port 443 if the SSL flag is
set and the NOSSL flag is not set.

Have you added SSL to the APACHE_SERVER_FLAGS line (between the quotes)
in the /etc/sysconfig/apache2 file? If now adding it you'll then need to
restart Apache.

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

smflood
19-Jan-2015, 14:49
On 18/01/2015 03:32, ab wrote:

> I think SLE 12 is using systemd; have you tried the systemd equivalent to
> start the service? I'm guessing it is something like this:
>
>

> sudo systemctl start apache2.service
>

The rcapache2 startup script still exists for SLES12 but has been
rewritten to reflect systemd rather than SysVinit.

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

carnold6
19-Jan-2015, 22:09
I finally got the SSL working but now face a mod_jk SLES 12 specific issue. In /etc/sysconfig/apache, in the apache_modules list I put jk and apache will not start. I remove jk from that file and apache starts. What is the correct syntax for mod_jk in the apache_modules?

smflood
20-Jan-2015, 11:49
On 19/01/2015 21:14, carnold6 wrote:

> I finally got the SSL working but now face a mod_jk SLES 12 specific
> issue. In /etc/sysconfig/apache, in the apache_modules list I put jk and
> apache will not start. I remove jk from that file and apache starts.
> What is the correct syntax for mod_jk in the apache_modules?

Presumably when you start Apache with mod_jk enabled (jk added to
APACHE_MODULES) an error is displayed?

When I installed the apache2-mod_jk package, enabled mod_jk ("a2enmod
jk"), then restarted Apache ("rcapache2 start") I got 'Job for
apache2.service failed. See "systemctl status apache2.service" and
"journalctl -xn" for details.'

Both "systemctl status apache2.service" (or "rcapache2 status") and
"journalctl -xn" show "httpd (no pid file) not running" with "tail
/var/log/apache2/error_log" revealing more with last two lines:

--begin--
No JkLogFile defined in httpd.conf. Using default /srv/www/logs/mod_jk.log
No such file or directory: mod_jk: could not open JkLog file
/srv/www/logs/mod_jk.log
---end---

Since the /srv/www/logs/ directory doesn't exist I'm not surprised it
failed but rather than create it I think the correct thing to do is add
a custom .conf file to /etc/apache2/conf.d/ with "JkLogFile
/var/log/apache2/mod_jk.log.

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

carnold6
20-Jan-2015, 16:16
On 19/01/2015 21:14, carnold6 wrote:

> I finally got the SSL working but now face a mod_jk SLES 12 specific
> issue. In /etc/sysconfig/apache, in the apache_modules list I put jk and
> apache will not start. I remove jk from that file and apache starts.
> What is the correct syntax for mod_jk in the apache_modules?

Presumably when you start Apache with mod_jk enabled (jk added to
APACHE_MODULES) an error is displayed?

When I installed the apache2-mod_jk package, enabled mod_jk ("a2enmod
jk"), then restarted Apache ("rcapache2 start") I got 'Job for
apache2.service failed. See "systemctl status apache2.service" and
"journalctl -xn" for details.'

Both "systemctl status apache2.service" (or "rcapache2 status") and
"journalctl -xn" show "httpd (no pid file) not running" with "tail
/var/log/apache2/error_log" revealing more with last two lines:

--begin--
No JkLogFile defined in httpd.conf. Using default /srv/www/logs/mod_jk.log
No such file or directory: mod_jk: could not open JkLog file
/srv/www/logs/mod_jk.log
---end---

Since the /srv/www/logs/ directory doesn't exist I'm not surprised it
failed but rather than create it I think the correct thing to do is add
a custom .conf file to /etc/apache2/conf.d/ with "JkLogFile
/var/log/apache2/mod_jk.log.

What i found was the jk module, when unloaded, allowed apache to start. I tried both mod_jk and jk in the apache modules line. What is suppose to be the correct text to load mod_jk?

rvillafafila
20-Jan-2015, 17:12
What i found was the jk module, when unloaded, allowed apache to start. I tried both mod_jk and jk in the apache modules line. What is suppose to be the correct text to load mod_jk?

To enable a module in apache don't edit /etc/sysconfig/apache file because SuSe-config command is not available in SLES 12.
Use the command
a2enmod jk and restart/reload apache with the command
systemctl restart/reload apache2
All these steps are assuming you have installed apache2-mod_jk package
If you find some problems starting apache2 with systemctl command, you can view the errors executing one of the next commands

systemctl status apache2 -l
or
journalctl -xn

carnold6
20-Jan-2015, 17:25
To enable a module in apache don't edit /etc/sysconfig/apache file because SuSe-config command is not available in SLES 12.
Use the command
a2enmod jk and restart/reload apache with the command
systemctl restart/reload apache2
All these steps are assuming you have installed apache2-mod_jk package

I ran a2enmod without any errors but when I use
systemctl restart/reload apache2 I get
start_apache[3548]: httpd (no pid file) not running and the only way to get apache running again is to remove jk from the /etc/sysconfig/apache file[/quote]


If you find some problems starting apache2 with systemctl command, you can view the errors executing one of the next commands

systemctl status apache2 -l
or
journalctl -xn


The above error is all that is reported from system status apache2 -l and journalctl -xn

smflood
20-Jan-2015, 17:53
On 20/01/2015 16:34, carnold6 wrote:

> rvillafafila;25903 Wrote:
>> To enable a module in apache don't edit /etc/sysconfig/apache file
>> because SuSe-config command is not available in SLES 12.
>> Use the command >
> Code:
> --------------------
> > > a2enmod jk
> --------------------
>>> and restart/reload apache with the command >
> Code:
> --------------------
> > > systemctl restart/reload apache2
> --------------------
>>>
>> *All these steps are assuming you have installed apache2-mod_jk
>> package*
>
> I ran a2enmod without any errors but when I use
> Code:
> --------------------
> systemctl restart/reload apache2
> --------------------
> I get
> Code:
> --------------------
> start_apache[3548]: httpd (no pid file) not running
> --------------------
> and the only way to get apache running again is to remove jk from the
> /etc/sysconfig/apache file
>
> If you find some problems starting apache2 with systemctl command, you
> can view the errors executing one of the next commands
>
> Code:
> --------------------
> systemctl status apache2 -l
> or
> journalctl -xn
>
> --------------------
>
>
> The above error is all that is reported from system status apache2 -l and
> journalctl -xn

(Re)Read my earlier reply where I worked through getting Apache to start
with mod_jk enabled. I'm guessing it's failing because mod_jk doesn't
have a valid directory to write log files to.

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

smflood
20-Jan-2015, 17:56
On 20/01/2015 16:14, rvillafafila wrote:

> To enable a module in apache don't edit /etc/sysconfig/apache file
> because SuSe-config command is not available in SLES 12.
> Use the command
> Code:
> --------------------
> a2enmod jk
> --------------------

Whilst the "SuSEconfig" command may not exist in SLE12 its files still
exist in /etc/sysconfig/ so as well as using "a2enmod jk" it's possible
to edit /etc/sysconfig/apache2 and add jk to APACHE_MODULES - it's what
the a2enmod command does.

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

rvillafafila
20-Jan-2015, 22:25
I ran a2enmod without any errors but when I use
systemctl restart/reload apache2 I get
start_apache[3548]: httpd (no pid file) not running and the only way to get apache running again is to remove jk from the /etc/sysconfig/apache file



The above error is all that is reported from system status apache2 -l and journalctl -xn[/QUOTE]

This error is produced because the apache2 service is not started yet.
Try to start it with this command

systemctl start apache2
Read smflood's posts because he explains you the same as me