Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apache2 failed to restart, invalid JKMount
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Tue Jun 20, 2017 7:51 am    Post subject: apache2 failed to restart, invalid JKMount Reply with quote

Hi, I had updated portage as stated in https://forums.gentoo.org/viewtopic-t-1064828-highlight-.html, now I found apache2 failed to restart. After reinstall several tools, such as passenger, rake, ruby and mod_jk, it still failed. So I look for help here, any suggestion would be grateful, thanks in advance!

1. The problem is:
Code:
/etc/init.d/apache2 restart
 * apache2 has detected an error in your setup:
Syntax error on line 12 of /etc/apache2/vhosts.d/01_myWeb_vhost.conf:
Invalid command 'JkMount', perhaps misspelled or defined by a module not included in the server configuration
 * ERROR: apache2 failed to stop


Code:
cat /etc/apache2/vhosts.d/01_myWeb_vhost.conf -n | head -n 20
     1   # Indexes: list the files in directory if home page specified by 'DirectoryIndex' can't be found
     2   # FollowSymLinks: allow linking out of the chroot directory
     3   # Includes: allow some 'Server-Side Include' program to run
     4   # MultiViews: alllow languages support of multiple languages (e.g.: make /foo.txt can be accessed by /foo)
     5   Listen 80
     6   NameVirtualHost *:80
     7   <VirtualHost *:80>
     8      ServerName www.myWeb.org
     9      ServerAdmin myWeb@myWeb.org
    10      ErrorLog /var/log/apache2/myWeb_error_log
    11      CustomLog /var/log/apache2/myWeb_access_log combined
    12      JkMount /* myWeb
    13      JkMount /*.jsp myWeb
    14      JkMount /*/servlet/ myWeb
    15      #JkUnMount /*.html myWeb
    16      #JkUnMount /*.css myWeb
    17      #JkUnMount /*.js myWeb
    18      #JkUnMount /*.json myWeb
    19      ErrorDocument 404 /error.jsp
    20   </VirtualHost>


2. Some content in /etc/apache2/httpd.conf:
Code:
# Supplemental configuration
#
# Most of the configuration files in the /etc/apache2/modules.d/ directory can
# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features
# or to modify the default configuration of the server.
#
# To know which flag to add to APACHE2_OPTS, look at the first line of the
# the file, which will usually be an <IfDefine OPTION> where OPTION is the
# flag to use.
Include /etc/apache2/modules.d/*.conf

# Virtual-host support
#
# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we
# include a default vhost (enabled by adding -D DEFAULT_VHOST to
# APACHE2_OPTS in /etc/conf.d/apache2).
Include /etc/apache2/vhosts.d/*.conf

# vim: ts=4 filetype=apache


3. The content of 88_mod_jk.conf:
Code:
cat /etc/apache2/modules.d/88_mod_jk.conf | grep -v "^#" | grep -v "^$"
<IfDefine JK>
LoadModule jk_module    modules/mod_jk.so
JkWorkersFile   /etc/apache2/jk-workers.properties
JkLogFile   /var/log/apache2/mod_jk.log
JkLogLevel   info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
  JkMount /*.jsp rhesusbase
  JkMount /*/servlet/* rhesusbase
jkAutoAlias /var/lib/tomcat-5.5/default/webapps/
</IfDefine>


4. The info related with mod_jk:
Code:
emerge --info mod_jk
Portage 2.3.5 (python 2.7.9-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.13-r4, 3.0.6-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.0.6-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E7450_@_2.40GHz-with-gentoo-2.1
KiB Mem:   127964740 total,  91879484 free
KiB Swap:   26218076 total,  26216768 free
Timestamp of repository gentoo: Thu, 15 Jun 2017 14:30:01 +0000
sh bash 4.2_p39
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
ccache version 3.1.6 [enabled]
app-shells/bash:          4.2_p39::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.3_rc4::gentoo
dev-lang/python:          2.7.9-r2::gentoo, 3.1.4-r3::gentoo, 3.2.3-r2::gentoo, 3.3.4::gentoo, 3.4.3::gentoo
dev-util/ccache:          3.1.6::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.1-r1::gentoo
sys-apps/openrc:          0.21.7::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6::gentoo, 1.12.5::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.5.3-r1::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 3.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.13-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/spool/torque"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 berkdb bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 modules multilib ncurses nls nptl openmp pam pcre readline seccomp session ssl tcpd unicode xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

www-apache/mod_jk-1.2.40::gentoo was built with the following:
USE="java" ABI_X86="64"


5. During reinstalling passenger, as there are new 30_mod_passenger.conf, I had delete old 89_mod_passenger.conf:
Code:
cat 89_mod_passenger.conf
#LoadModule passenger_module /usr/local/lib64/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
#PassengerRoot /usr/local/lib64/ruby/gems/1.8/gems/passenger-4.0.5
#PassengerDefaultRuby /usr/bin/ruby18
PassengerRoot /usr/lib64/ruby/vendor_ruby/phusion_passenger/locations.ini

cat /etc/apache2/modules.d/30_mod_passenger.conf | grep -v "^#" | grep -v "^$"
<IfDefine PASSENGER>
LoadModule passenger_module modules/mod_passenger.so
PassengerRoot /usr/lib64/ruby/vendor_ruby/phusion_passenger/locations.ini
PassengerLogLevel 0
PassengerDefaultRuby /usr/bin/ruby
PassengerMaxPoolSize 20
PassengerPoolIdleTime 120
PassengerMaxInstancesPerApp 0
PassengerUserSwitching On
PassengerDefaultUser apache
</IfDefine>


6. Besides, I found there isn't a java in the machine, should I install jdk first?
Code:
which java
which: no java in (/sbin:/bin:/usr/sbin:/usr/bin)

which jdk
which: no jdk in (/sbin:/bin:/usr/sbin:/usr/bin)


Code:
emerge --info jdk
Portage 2.3.5 (python 2.7.9-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.13-r4, 3.0.6-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.0.6-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E7450_@_2.40GHz-with-gentoo-2.1
KiB Mem:   127964740 total,  91852344 free
KiB Swap:   26218076 total,  26216768 free
Timestamp of repository gentoo: Thu, 15 Jun 2017 14:30:01 +0000
sh bash 4.2_p39
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
ccache version 3.1.6 [enabled]
app-shells/bash:          4.2_p39::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.3_rc4::gentoo
dev-lang/python:          2.7.9-r2::gentoo, 3.1.4-r3::gentoo, 3.2.3-r2::gentoo, 3.3.4::gentoo, 3.4.3::gentoo
dev-util/ccache:          3.1.6::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.1-r1::gentoo
sys-apps/openrc:          0.21.7::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6::gentoo, 1.12.5::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.5.3-r1::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 3.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.13-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/spool/torque"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 berkdb bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 modules multilib ncurses nls nptl openmp pam pcre readline seccomp session ssl tcpd unicode xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

virtual/jdk-1.6.0::gentoo was built with the following:
USE=""
CHOST=""
CFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer"
CXXFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer"


virtual/jdk-1.7.0::gentoo was built with the following:
USE="test"
CHOST=""
CFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer"
CXXFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer"


[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. OP: please use code tags for formatted output, not quote tags. -Hu]
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Tue Jun 20, 2017 7:07 pm    Post subject: Reply with quote

Missing defines in /etc/conf.d/apache2?
Back to top
View user's profile Send private message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Wed Jun 21, 2017 11:55 am    Post subject: Reply with quote

Hi, Ant P, thanks for your reply.

My /etc/conf.d/apache2 was listed below, I had tried uncomment "#CONFIGFILE=/etc/apache2/httpd.conf", but it doesn't work. Also, in /etc/apache2/httpd.conf above, I had include "Include /etc/apache2/modules.d/*.conf ", Could you give me other suggestion?

It's luck that I update software after it was running :)

Best wishes!

Code:
cat /etc/conf.d/apache2
# /etc/conf.d/apache2: config file for /etc/init.d/apache2

# When you install a module it is easy to activate or deactivate the modules
# and other features of apache using the APACHE2_OPTS line. Every module should
# install a configuration in /etc/apache2/modules.d. In that file will have an
# <IfDefine NNN> directive where NNN is the option to enable that module.
#
# Here are the options available in the default configuration:
#
#  AUTH_DIGEST  Enables mod_auth_digest
#  AUTHNZ_LDAP  Enables authentication through mod_ldap (available if USE=ldap)
#  CACHE        Enables mod_cache
#  DAV          Enables mod_dav
#  ERRORDOCS    Enables default error documents for many languages.
#  INFO         Enables mod_info, a useful module for debugging
#  LANGUAGE     Enables content-negotiation based on language and charset.
#  LDAP         Enables mod_ldap (available if USE=ldap)
#  MANUAL       Enables /manual/ to be the apache manual (available if USE=docs)
#  MEM_CACHE    Enables default configuration mod_mem_cache
#  PROXY        Enables mod_proxy
#  SSL          Enables SSL (available if USE=ssl)
#  STATUS       Enabled mod_status, a useful module for statistics
#  SUEXEC       Enables running CGI scripts (in USERDIR) through suexec.
#  USERDIR      Enables /~username mapping to /home/username/public_html
#
#
# The following two options provide the default virtual host for the HTTP and
# HTTPS protocol. YOU NEED TO ENABLE AT LEAST ONE OF THEM, otherwise apache
# will not listen for incomming connections on the approriate port.
#
#  DEFAULT_VHOST      Enables name-based virtual hosts, with the default
#                     virtual host being in /var/www/localhost/htdocs
#  SSL_DEFAULT_VHOST  Enables default vhost for SSL (you should enable this
#                     when you enable SSL)
#
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE"

# Extended options for advanced uses of Apache ONLY
# You don't need to edit these unless you are doing crazy Apache stuff
# As not having them set correctly, or feeding in an incorrect configuration
# via them will result in Apache failing to start
# YOU HAVE BEEN WARNED.

# PID file
#PIDFILE=/var/run/apache2.pid

# timeout for startup/shutdown checks
#TIMEOUT=10

# ServerRoot setting
#SERVERROOT=/usr/lib64/apache2

# Configuration file location
# - If this does NOT start with a '/', then it is treated relative to
# $SERVERROOT by Apache
#CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to
# They are normally dumped to your terminal.
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# A command that outputs a formatted text version of the HTML at the URL
# of the command line. Designed for lynx, however other programs may work.
#LYNX="lynx -dump"

# The URL to your server's mod_status status page.
# Required for status and fullstatus
#STATUSURL="http://localhost/server-status"

# Method to use when reloading the server
# Valid options are 'restart' and 'graceful'
# See http://httpd.apache.org/docs/2.2/stopping.html for information on
# what they do and how they differ.
#RELOAD_TYPE="graceful"


Last edited by lamz138138 on Thu Jun 22, 2017 2:12 am; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Jun 21, 2017 5:04 pm    Post subject: Reply with quote

Missing "-D JK"
Back to top
View user's profile Send private message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Wed Jun 21, 2017 5:23 pm    Post subject: Reply with quote

Thanks for your reply again.

After adding "-D JK" to APACHE2_OPTS in /etc/conf.d/apache2 , it can shutdown. However, it failed to start. Following is related information:
Quote:
/etc/init.d/apache2 restart
* Starting apache2 ...
Warning: DocumentRoot [/rd1/user/zhangsj/2016Summer] does not exist
Warning: DocumentRoot [/rd1/user/zhongxm/temp/web/tomcat/tomcat_base/webapps/2pm] does not exist
apache2: Could not reliably determine the server's fully qualified domain name, using 202.205.131.254 for ServerName
[Thu Jun 22 09:07:33 2017] [warn] NameVirtualHost *:80 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:9999
no listening sockets available, shutting down
Unable to open logs
* start-stop-daemon: failed to start `/usr/sbin/apache2' [ !! ]
* ERROR: apache2 failed to start


But I couldn't find anything take port 80 or 9999, how should I do?
Quote:
netstat -lnp | grep 80
tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 2807/spamd child
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 20331/java
tcp6 0 0 :::8009 :::* LISTEN 20331/java
tcp6 0 0 ::1:783 :::* LISTEN 2807/spamd child
tcp6 0 0 :::8080 :::* LISTEN 20331/java
udp 0 0 0.0.0.0:48099 0.0.0.0:* 18639/(squid-1)
Back to top
View user's profile Send private message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Wed Jun 21, 2017 5:42 pm    Post subject: Reply with quote

Besides, I found I didn't have /etc/init.d/httpd, should I install it?
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Jun 21, 2017 6:01 pm    Post subject: Reply with quote

You shouldn't have a file called /etc/init.d/httpd.

Those errors sound like another apache is already running outside the control of openrc. You have to stop that manually before restarting the initscript.
Back to top
View user's profile Send private message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Wed Jun 21, 2017 6:11 pm    Post subject: Reply with quote

Hi, thanks for reply again.

There no apache running. I found the file /etc/init.d/apach2 is new, while /usr/sbin/apache2 is old, so I think the problem was caused by old software and emerge apache2. However, it output following error:
Quote:
/etc/init.d/apache2 start
* apache2 has detected an error in your setup:
apache2: Syntax error on line 147 of /etc/apache2/httpd.conf: Syntax error on line 2 of /etc/apache2/modules.d/88_mod_jk.conf: Cannot load modules/mod_jk.so into server: /usr/lib64/apache2/modules/mod_jk.so: undefined symbol: unixd_set_global_mutex_perms
* ERROR: apache2 failed to start


Code:
cat -n /etc/apache2/modules.d/88_mod_jk.conf -n
     1   <IfDefine JK>
     2   LoadModule jk_module    modules/mod_jk.so
     3   
     4   ###
     5   ### Where to find workers.properties
     6   ###
     7   # JkWorkersFile specify the location where mod_jk will find
     8   # the workers definitions.
     9   JkWorkersFile   /etc/apache2/jk-workers.properties
    10   
    11   
    12   ###
    13   ### Where to put mod_jk logs
    14   ###
    15   # specify the location where mod_jk is going to place its log file.
    16   JkLogFile   /var/log/apache2/mod_jk.log
    17   
    18   
    19   ###
    20   ### Set the jk log level [debug/error/info]
    21   ###
    22   # info log will contains standard mod_jk activity (default).
    23   # error log will contains also error reports.
    24   # debug log will contains all informations on mod_jk activity
    25   JkLogLevel   info
    26   
    27   
    28   ###
    29   ### Select the log format
    30   ###
    31   # JkLogStampFormat will configure the date/time format found
    32   # on mod_jk logfile. Using the strftime() format string it's
    33   # set by default to "[%a %b %d %H:%M:%S %Y]"
    34   JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    35   
    36   
    37   ###
    38   ### JkOptions indicate to send SSL KEY SIZE,
    39   ###
    40   # The directive JkOptions allow you to set many forwarding
    41   # options which will enable (+) or disable (-) following option.
    42   #
    43   #
    44   # JkOptions ForwardKeySize , you ask mod_jk, when using ajp13, to
    45   # forward also the SSL Key Size as required by Servlet API 2.3.
    46   # This flag shouldn't be set when servlet engine is Tomcat 3.2.x
    47   # (on by default).
    48   #
    49   #
    50   # JkOptions ForwardURICompat , you told mod_jk to send the URI to
    51   # Tomcat normally, which is less spec compliant but mod_rewrite
    52   # compatible, use it for compatibility with Tomcat 3.2.x engines
    53   # (on by default).
    54   #
    55   #
    56   # JkOptions ForwardURICompatUnparsed , the forwarded URI is unparsed,
    57   # it's spec compliant but broke mod_rewrite.
    58   #
    59   #
    60   # JkOptions ForwardURIEscaped , the forwarded URI is escaped and
    61   # Tomcat (since 3.3 rc2) will do the decoding part.
    62   #
    63   #
    64   # JkOptions ForwardDirectories is used in conjunction with Directory-
    65   # Index directive of Apache web server. As such mod_dir should be
    66   # available to Apache, statically or dynamically (DSO)
    67   #
    68   # When DirectoryIndex is configured, Apache will create sub-requests
    69   # for each of the local-url's specified in the directive, to determine
    70   # if there is a local file that matches (this is done by stat-ing the file).
    71   #
    72   # If ForwardDirectories is set to false (default) and Apache doesn't
    73   # find any files that match, Apache will serve the content of the
    74   # directory (if directive Options specifies Indexes for that directory)
    75   # or a 403 Forbidden response (if directive Options doesn't specify
    76   # Indexes for that directory).
    77   #
    78   # If ForwardDirectories is set to true and Apache doesn't find any
    79   # files that match, the request will be forwarded to Tomcat for
    80   # resolution. This is used in cases when Apache cannot see the index
    81   # files on the file system for various reasons: Tomcat is running on
    82   # a different machine, the JSP file has been precompiled etc.
    83   #
    84   # Note that locally visible files will take precedence over the ones
    85   # visible only to Tomcat (i.e. if Apache can see the file, that's
    86   # the one that's going to get served). This is important if there is
    87   # more then one type of file that Tomcat normally serves - for
    88   # instance Velocity pages and JSP pages.
    89   #
    90   JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    91   
    92   
    93   ###
    94   ### JkEnvVar forward environment vars
    95   ###
    96   # The directive JkEnvVar allow you to forward an environment vars
    97   # from Apache server to Tomcat engine.
    98   #
    99   #JkEnvVar SSL_CLIENT_V_START
   100   
   101   
   102   ###
   103   ### JkRequestLogFormat set the request format
   104   ###
   105   # JkRequestLogFormat will configure the format of mod_jk individual
   106   # request logging. Request logging is configured and enabled on a
   107   # per virtual host basis. To enable request logging for a virtual
   108   # host just add a JkRequestLogFormat config. The syntax of the
   109   # format string is similiar to the Apache LogFormat command, here
   110   # is a list of the available request log format options:
   111   #
   112   # Options   Description
   113   # %b      Bytes sent, excluding HTTP headers (CLF format)
   114   # %B      Bytes sent, excluding HTTP headers
   115   # %H      The request protocol
   116   # %m      The request method
   117   # %p      The canonical Port of the server serving the request
   118   # %q      The query string (prepended with a ? if a query string exists, otherwise an empty string)
   119   # %r      First line of request
   120   # %s      Request HTTP status code
   121   # %T      Request duration, elapsed time to handle request in seconds '.' micro seconds
   122   # %U      The URL path requested, not including any query string.
   123   # %v      The canonical ServerName of the server serving the request
   124   # %V      The server name according to the UseCanonicalName setting
   125   # %w      Tomcat worker name
   126   #
   127   JkRequestLogFormat "%w %V %T"
   128   
   129   
   130   ###
   131   ### JkMount assign specific URLs to Tomcat
   132   ###
   133   # JkMount directive assign specific URLs to Tomcat. In general the
   134   # structure of a JkMount directive is:
   135   #
   136   # send all requests ending in .jsp to worker1
   137     JkMount /*.jsp rhesusbase
   138   #
   139   # send all requests ending /servlet to worker1
   140     JkMount /*/servlet/* rhesusbase
   141   #
   142   # send all requests jsp requests to files located in /otherworker will go worker2
   143   #  JkMount /otherworker/*.jsp worker2
   144   #
   145   #
   146   # You can use the JkMount directive at the top level or inside
   147   # <VirtualHost> sections of your httpd.conf file.
   148   #
   149   
   150   
   151   # We specify an autoalias, that makes it possible that apache is still
   152   # reponsible for serving static html files. All requests of files with
   153   # the ending .jsp will be redirected to a default Tomcat installation which
   154   # uses the default profile. Change this to fit your needs.
   155   jkAutoAlias /var/lib/tomcat-5.5/default/webapps/
   156   </IfDefine>
   157   
   158   # vim: ts=4 filetype=apache

I then delete this file,
Quote:
/etc/init.d/apache2 start
* apache2 has detected an error in your setup:
AH00526: Syntax error on line 60 of /etc/apache2/modules.d/40_mod_ssl.conf:
Invalid Mutex directory in argument file:/run/apache_ssl_mutex
* ERROR: apache2 failed to start


Code:
cat -n /etc/apache2/modules.d/40_mod_ssl.conf
     1   # Note: The following must must be present to support
     2   # starting without SSL on platforms with no /dev/random equivalent
     3   # but a statically compiled-in mod_ssl.
     4   <IfModule ssl_module>
     5   SSLRandomSeed startup builtin
     6   SSLRandomSeed connect builtin
     7   </IfModule>
     8   
     9   <IfDefine SSL>
    10   # This is the Apache server configuration file providing SSL support.
    11   # It contains the configuration directives to instruct the server how to
    12   # serve pages over an https connection. For detailing information about these
    13   # directives see <URL:http://httpd.apache.org/docs/2.4/mod/mod_ssl.html>
    14   
    15   # Do NOT simply read the instructions in here without understanding
    16   # what they do.  They're here only as hints or reminders. If you are unsure
    17   # consult the online docs. You have been warned.
    18   
    19   ## Pseudo Random Number Generator (PRNG):
    20   # Configure one or more sources to seed the PRNG of the SSL library.
    21   # The seed data should be of good random quality.
    22   # WARNING! On some platforms /dev/random blocks if not enough entropy
    23   # is available. This means you then cannot use the /dev/random device
    24   # because it would lead to very long connection times (as long as
    25   # it requires to make more entropy available). But usually those
    26   # platforms additionally provide a /dev/urandom device which doesn't
    27   # block. So, if available, use this one instead. Read the mod_ssl User
    28   # Manual for more details.
    29   #SSLRandomSeed startup file:/dev/random  512
    30   #SSLRandomSeed startup file:/dev/urandom 512
    31   #SSLRandomSeed connect file:/dev/random  512
    32   #SSLRandomSeed connect file:/dev/urandom 512
    33   
    34   ## SSL Global Context:
    35   # All SSL configuration in this context applies both to the main server and
    36   # all SSL-enabled virtual hosts.
    37   
    38   # Some MIME-types for downloading Certificates and CRLs
    39   <IfModule mime_module>
    40      AddType application/x-x509-ca-cert .crt
    41      AddType application/x-pkcs7-crl    .crl
    42   </IfModule>
    43   
    44   ## Pass Phrase Dialog:
    45   # Configure the pass phrase gathering process. The filtering dialog program
    46   # (`builtin' is a internal terminal dialog) has to provide the pass phrase on
    47   # stdout.
    48   SSLPassPhraseDialog  builtin
    49   
    50   ## Inter-Process Session Cache:
    51   # Configure the SSL Session Cache: First the mechanism  to use and second the
    52   # expiring timeout (in seconds).
    53   #SSLSessionCache      dbm:/run/ssl_scache
    54   SSLSessionCache         shmcb:/run/ssl_scache(512000)
    55   SSLSessionCacheTimeout  300
    56   
    57   ## Semaphore:
    58   # Configure the path to the mutual exclusion semaphore the SSL engine uses
    59   # internally for inter-process synchronization.
    60   Mutex file:/run/apache_ssl_mutex ssl-cache
    61   
    62   ## SSL Compression:
    63   # Known to be vulnerable thus disabled by default (bug #507324).
    64   SSLCompression off
    65   </IfDefine>
    66   
    67   # vim: ts=4 filetype=apache

I also delete this file, then:
Quote:
/etc/init.d/apache2 start
* apache2 has detected an error in your setup:
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/vhosts.d/01_rhesusbase_vhost.conf:6
AH00526: Syntax error on line 12 of /etc/apache2/vhosts.d/01_rhesusbase_vhost.conf:
Invalid command 'JkMount', perhaps misspelled or defined by a module not included in the server configuration
* ERROR: apache2 failed to start


I also check the "-D JK" in /etc/conf.d/apache2 (APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK"), what should I do?

Best wishes!


Last edited by lamz138138 on Thu Jun 22, 2017 2:14 am; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Jun 21, 2017 11:03 pm    Post subject: Reply with quote

I hope you had backups of those files... deleting them has only made your problems worse. You need to start reading what it's trying to tell you, and fix the problems instead of trying to shotgun debug until it stops complaining.

Start by reinstalling apache and whatever extra modules you have to get things back into a sane state.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Thu Jun 22, 2017 12:49 am    Post subject: Reply with quote

Also, please use [code] tags for output from configuration files. I cleaned up the first dozen or so times you posted with quote tags when you should have used code tags, but at some point, you need to start helping people help you.
Back to top
View user's profile Send private message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Thu Jun 22, 2017 2:30 am    Post subject: Reply with quote

Hi, Ant P. I had backup these files, I said delete just for simplification. I had google, but I found they didn't work, such as there aren't -M for apache2 in my machine :( I also confirm mod_jk.so is latest and locate in /usr/lib64/apache2/modules/, I don't know whether it was caused by mis-configuration
Back to top
View user's profile Send private message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Thu Jun 22, 2017 3:26 am    Post subject: Reply with quote

Hi, Hu!

I had updated related tag, thanks for your remind!
Back to top
View user's profile Send private message
lamz138138
n00b
n00b


Joined: 21 Feb 2017
Posts: 41

PostPosted: Thu Jun 22, 2017 11:59 am    Post subject: Reply with quote

Hi, I had solved some previous problem, they were caused by the new apache 2.4 version. However, there are new problems I couldn't solve at the moment:

First, start apache:

Code:
/etc/init.d/apache2 start
 * Starting apache2 ...
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:9999
no listening sockets available, shutting down
AH00015: Unable to open logs
 * start-stop-daemon: failed to start `/usr/sbin/apache2'                                                                                                                                                                                                               [ !! ]
 * ERROR: apache2 failed to start

I found two files (00_default_vhost.conf and 01_myWeb_vhost.conf) located in /etc/apache2/vhost.d that all contain "listen 80", so I comment this line in 00_default_vhost.conf:
Code:
/etc/init.d/apache2 start
 * Starting apache2 ...                                                                                                                                                                                                                                                 [ !! ]
 * ERROR: apache2 failed to start

Although it complain failed, I found apache had been started, and my web could be visited:
Code:
ps -ef | grep apache
apache   15129 18565  0 02:46 ?        00:00:00 spamd child
apache   15130 18565  0 02:46 ?        00:00:00 spamd child
rbase    15281     1  6 02:50 pts/9    00:01:10 /opt/icedtea-bin-7.2.1/bin/java -Djava.util.logging.config.file=/rd1/user/rbase/tomcat_base/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache-tomcat-6.0.35/endorsed -classpath /opt/apache-tomcat-6.0.35/bin/bootstrap.jar -Dcatalina.base=/rd1/user/rbase/tomcat_base -Dcatalina.home=/opt/apache-tomcat-6.0.35 -Djava.io.tmpdir=/rd1/user/rbase/tomcat_base/temp org.apache.catalina.startup.Bootstrap -Dcatalina.base start
root     15705     1  0 03:08 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   15707 15705  0 03:08 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   15708 15705  0 03:08 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   15709 15705  0 03:08 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   15710 15705  0 03:08 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   15711 15705  0 03:08 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   15712 15705  0 03:08 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
root     15746 15376  0 03:09 pts/2    00:00:00 grep --colour=auto apache
root     18565     1  0 Jun07 ?        00:02:30 /usr/sbin/spamd -d -r /run/spamd.pid -m 5 -c -H -u apache -x --virtual-config-dir /var/mailbox/%d/%l/spamassassin

In the log, I found following information:
Code:
[Fri Jun 23 03:08:57.000424 2017] [jk:warn] [pid 15704] No JkShmFile defined in httpd.conf. Using default /rd1/user/oryza/logs/jk-runtime-status
[Fri Jun 23 03:08:58.000549 2017] [jk:warn] [pid 15705] No JkShmFile defined in httpd.conf. Using default /rd1/user/oryza/logs/jk-runtime-status
[Fri Jun 23 03:08:58.004977 2017] [mpm_prefork:notice] [pid 15705] AH00163: Apache/2.4.25 (Unix) OpenSSL/1.0.2k mod_jk/1.2.40 configured -- resuming normal operations
[Fri Jun 23 03:08:58.005038 2017] [core:notice] [pid 15705] AH00094: Command line: '/usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D JK -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf'


Any suggestion would be grateful!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum