Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

APACHE 2 DOES NOT START

Wed Jan 04, 2017 2:41 pm

Hi All my apache2 does not want to start

concerned i have tried too much to fix

pi@Kallie:~ $ sudo service apache2 status
● apache2.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

Jan 04 13:54:39 Kallie systemd[1]: Stopping LSB: Apache2 web server...
Jan 04 13:54:41 Kallie apache2[6048]: Stopping web server: apache2.
Jan 04 13:54:41 Kallie systemd[1]: Stopped LSB: Apache2 web server.
pi@Kallie:~ $


Please help

User avatar
DougieLawson
Posts: 36897
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 4:58 pm

What's in /var/log/apache2/error.log?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

FlexibleSigmoid
Posts: 61
Joined: Sun Jul 03, 2016 1:33 am

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 5:20 pm

That error means that there is no `apache2` service file.

Which OS are you running?
If Debian based, try

Code: Select all

apt-cache policy apache2

Does apache show in the list of unit-files for systemd?

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 7:32 pm

[Wed Jan 04 14:51:29.942731 2017] [mpm_event:notice] [pid 16666:tid 1996353536] AH00489: Apache/2.4.10 (Raspbian) configured -- resuming norm$
[Wed Jan 04 14:51:29.943110 2017] [core:notice] [pid 16666:tid 1996353536] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jan 04 14:52:14.452434 2017] [mpm_event:notice] [pid 16666:tid 1996353536] AH00491: caught SIGTERM, shutting down
[Wed Jan 04 14:52:15.752238 2017] [mpm_event:notice] [pid 17004:tid 1995452416] AH00489: Apache/2.4.10 (Raspbian) configured -- resuming norm$
[Wed Jan 04 14:52:15.752564 2017] [core:notice] [pid 17004:tid 1995452416] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jan 04 14:56:39.791915 2017] [mpm_event:notice] [pid 17004:tid 1995452416] AH00491: caught SIGTERM, shutting down
[Wed Jan 04 14:56:41.039803 2017] [mpm_prefork:notice] [pid 18175] AH00163: Apache/2.4.10 (Raspbian) configured -- resuming normal operations
[Wed Jan 04 14:56:41.040099 2017] [core:notice] [pid 18175] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jan 04 14:56:43.141821 2017] [mpm_prefork:notice] [pid 18175] AH00169: caught SIGTERM, shutting down
[Wed Jan 04 14:56:44.560993 2017] [mpm_prefork:notice] [pid 18279] AH00163: Apache/2.4.10 (Raspbian) configured -- resuming normal operations
[Wed Jan 04 14:56:44.561148 2017] [core:notice] [pid 18279] AH00094: Command line: '/usr/sbin/apache2'


error log

I have no idea?

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 7:37 pm

FlexibleSigmoid wrote:That error means that there is no `apache2` service file.

Which OS are you running?
If Debian based, try

Code: Select all

apt-cache policy apache2

Does apache show in the list of unit-files for systemd?
OS debian jessie
pi 3
apt -cashe policy does not work
Sorry I dont know how to look for unit files for systemd?
tried to google it but not sure what to answer
sorry

User avatar
B.Goode
Posts: 9057
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 7:44 pm

apt -cashe policy does not work
No surprise there!

How about

Code: Select all

apt-cache policy apache2
as suggested?

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 7:46 pm

Hi
I get this when I start apache2?

pi@Kallie:/var/log/apache2 $ sudo service apache2 start
Warning: Unit file of apache2.service changed on disk, 'systemctl daemon-reload' recommended.

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 7:50 pm

B.Goode wrote:
apt -cashe policy does not work
No surprise there!

How about

Code: Select all

apt-cache policy apache2
as suggested?
oops noobs sorry

Got this when I ran it correctly

apache2:
Installed: 2.4.10-10+deb8u7
Candidate: 2.4.10-10+deb8u7
Version table:
*** 2.4.10-10+deb8u7 0
500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages
100 /var/lib/dpkg/status
pi@Kallie:/var/log/apache2 $

User avatar
DougieLawson
Posts: 36897
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 8:00 pm

sudo nano /etc/apache2/apache2.conf and change

Code: Select all

#
# 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
to

Code: Select all

#
# 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 debug
Docs at: https://httpd.apache.org/docs/2.4/mod/c ... l#loglevel

You should see a lot more stuff written to /var/local/apache2/error.log
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 9:18 pm

DougieLawson wrote:sudo nano /etc/apache2/apache2.conf and change

Code: Select all

#
# 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
to

Code: Select all

#
# 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 debug
Docs at: https://httpd.apache.org/docs/2.4/mod/c ... l#loglevel

You should see a lot more stuff written to /var/local/apache2/error.log

I dont have a /etc/apache2/apache2.conf file
there is no apache2 in /etc

pi@Kallie:/etc $ ls
adduser.conf dhcp gtk-3.0 lightdm nsswitch.conf rc6.d subuid-
alternatives dhcp3 hdparm.conf lighttpd ntp.conf rc.local sudoers
apm dhcpcd.conf host.conf locale.alias openal rcS.d sudoers.d
apparmor.d dhcpcd.duid hostname locale.gen opt request-key.d sysctl.conf
apt dictionaries-common hosts localtime os-release resolvconf sysctl.d
avahi dillo hosts.allow logcheck PackageKit resolv.conf systemd
axis2.xml dphys-swapfile hosts.deny login.defs pam.conf resolvconf.conf terminfo
bash.bashrc dpkg idmapd.conf logrotate.conf pam.d rmt timezone
bash_completion drirc ifplugd logrotate.d passwd rpc timidity
bash_completion.d emacs init machine-id passwd- rpi-issue tmpfiles.d
bindresvport.blacklist environment init.d magic perl rsyslog.conf triggerhappy
binfmt.d esound initramfs-tools magic.mime php5 rsyslog.d ucf.conf
bluetooth fake-hwclock.data inputrc mailcap plymouth RTIMULib.ini udev
ca-certificates fb.modes insserv mailcap.order polkit-1 samba udisks2
ca-certificates.conf fonts insserv.conf manpath.config ppp securetty ufw
calendar fstab insserv.conf.d menu-methods profile security usb_modeswitch.conf
chromium-browser fuse.conf iproute2 mime.types profile.d selinux usb_modeswitch.d
console-setup gai.conf issue mke2fs.conf protocols services vdpau_wrapper.cfg
cron.d gconf issue.net modprobe.d pulse sgml vim
cron.daily gdb kbd modules python shadow vnc
cron.hourly ghostscript kernel modules-load.d python2.7 shadow- webiopi
cron.monthly gnome ldap motd python3 shells wgetrc
crontab groff ld.so.cache mtab python3.4 skel wildmidi
cron.weekly group ld.so.conf myDevices rc0.d ssh wpa_supplicant
dbus-1 group- ld.so.conf.d nanorc rc1.d ssl X11
debconf.conf gshadow ld.so.preload netconfig rc2.d staff-group-for-usr-local xdg
debian_version gshadow- libaudit.conf network rc3.d subgid xml
default gss libnl-3 networks rc4.d subgid- xpdf
deluser.conf gtk-2.0 libreoffice newt rc5.d subuid
pi@Kallie:/etc $ whereis apache2.conf
apache2:

User avatar
DougieLawson
Posts: 36897
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 9:24 pm

What OS are you running? If it's not Raspbian I can't help you any further.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 9:40 pm

Hi
/etc/apache2/conf-available/apache2-doc.conf

it looks like this
Alias /manual /usr/share/doc/apache2-doc/manual/

<Directory "/usr/share/doc/apache2-doc/manual/">
Options Indexes FollowSymlinks
AllowOverride All
Require all granted
AddDefaultCharset off
</Directory>

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 9:42 pm

DougieLawson wrote:What OS are you running? If it's not Raspbian I can't help you any further.

debian on raspberry pi 3 (jessie)

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 9:55 pm

Hi

when I run

pi@Kallie:/etc/apache2 $ sudo service apache2 start
Warning: Unit file of apache2.service changed on disk, 'systemctl daemon-reload' recommended.
appears
maybe that helps?

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 9:57 pm

Venno wrote:
DougieLawson wrote:What OS are you running? If it's not Raspbian I can't help you any further.

debian on raspberry pi 3 (jessie)
sorry raspbian

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 10:00 pm

pi@Kallie:/etc/apache2 $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@Kallie:/etc/apache2 $

User avatar
DougieLawson
Posts: 36897
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 10:04 pm

sudo apt-get purge apache2
sudo apt-get install apache2


That should remove all the changes you've made to the configuration files and give you an Apache2 installation that "just works".
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Venno
Posts: 27
Joined: Tue Apr 22, 2014 6:24 pm

Re: APACHE 2 DOES NOT START

Wed Jan 04, 2017 10:22 pm

DougieLawson wrote:sudo apt-get purge apache2
sudo apt-get install apache2


That should remove all the changes you've made to the configuration files and give you an Apache2 installation that "just works".
hi thanks

it works till I reboot then we are back to the same old
could you advise how to "reset my pi 3 " to clean it of all except essential files "reset" from terminal

User avatar
DougieLawson
Posts: 36897
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: APACHE 2 DOES NOT START

Thu Jan 05, 2017 12:00 am

Every time you reboot run sudo systemctl daemon-reload and you'll get rid of that useless warning message. It does not stop your Apache2 task from starting.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: APACHE 2 DOES NOT START

Thu Jan 05, 2017 10:38 am

There's a thread about the systemctl daemon-reload bits on here viewtopic.php?f=29&t=160476

User avatar
DougieLawson
Posts: 36897
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: APACHE 2 DOES NOT START

Thu Jan 05, 2017 10:43 am

mfa298 wrote:There's a thread about the systemctl daemon-reload bits on here viewtopic.php?f=29&t=160476
This one: viewtopic.php?p=1056367#p1056367 seems to be the simple solution.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

pratikpatel1221
Posts: 2
Joined: Tue Sep 25, 2018 3:20 am

APACHE 2 DOES NOT START

Wed Sep 26, 2018 5:33 pm

When I checked the status of apache using the command (sudo service apache2 status)
Below error messages are displayed:

Code: Select all

 apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-09-25 09:36:03 IST; 1 day 13h ago
  Process: 365 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Sep 25 09:36:03 raspberrypi apachectl[365]: AH00558: apache2: Could not reliably determine
Sep 25 09:36:03 raspberrypi apachectl[365]: (98)Address already in use: AH00072: make_sock
Sep 25 09:36:03 raspberrypi apachectl[365]: no listening sockets available, shutting down
Sep 25 09:36:03 raspberrypi apachectl[365]: AH00015: Unable to open logs
Sep 25 09:36:03 raspberrypi apachectl[365]: Action 'start' failed.
Sep 25 09:36:03 raspberrypi apachectl[365]: The Apache error log may have more information
Sep 25 09:36:03 raspberrypi systemd[1]: apache2.service: Control process exited, code=exit
Sep 25 09:36:03 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
Sep 25 09:36:03 raspberrypi systemd[1]: apache2.service: Unit entered failed state.
Sep 25 09:36:03 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
# It was working perfectly before I have updated the config file ( path : /etc/apache2/sites-enabled/000-default.conf)
#Added THE FOLLOWING to the 000-default file

Code: Select all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AddHandler cgi-script .cgi .pl .py
Order allow,deny
Allow from all
</Directory>

</VirtualHost>
Please help.

fbe
Posts: 576
Joined: Thu Aug 17, 2017 9:08 pm

Re: APACHE 2 DOES NOT START

Wed Sep 26, 2018 8:11 pm

Code: Select all

...
Sep 25 09:36:03 raspberrypi apachectl[365]: The Apache error log may have more information
...
Look into /var/log/apache2/error.log

Undo your changes in /etc/apache2/sites-enabled/000-default.conf.

Code: Select all

sudo a2enmod cgi
sudo systemctl restart apache2
should do it instead.

Look into /etc/apache2/conf-enabled/serve-cgi-bin.conf

pratikpatel1221
Posts: 2
Joined: Tue Sep 25, 2018 3:20 am

Re: APACHE 2 DOES NOT START

Fri Sep 28, 2018 4:19 pm

Thanks for the solution.
As per your suggestion - "Undo your changes in /etc/apache2/sites-enabled/000-default.conf", I have reverted the changes of conf file and it is working fine.

However, the changes I have made which was required to execute the Python file from the web.

Could you please provide the better solution to execute the Python file from web URL (i.e. server side script)?

fruitoftheloom
Posts: 21379
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: APACHE 2 DOES NOT START

Fri Sep 28, 2018 5:00 pm

Venno wrote:
Wed Jan 04, 2017 9:42 pm
DougieLawson wrote:What OS are you running? If it's not Raspbian I can't help you any further.

debian on raspberry pi 3 (jessie)

You should nowadays be running Raspbian Stretch as it has been the supported OS for over a year:

https://www.raspberrypi.org/downloads/raspbian/


This is a relevant guide for a LAMP:

https://projects.raspberrypi.org/en/pro ... -wordpress

.
Retired disgracefully.....
......to a more gentile life !

Return to “Beginners”