Question

Apache2 Restart Problem

So everytime i type “service apache2 restart” into putty, i get an error

apache2: Syntax error on line 268 of /etc/apache2/apache2.conf: Syntax error on line 30 of /etc/apache2/sites-enabled/000-default: Expected </Directory> but saw </VirtualHost> Action ‘configtest’ failed. The Apache error log may have more information. can anyone help me?

Subscribe
Share
Sep 04 13:32:42 vps-65dbc114 sudo[191519]: pam_unix(sudo:session): session closed for user root
Sep 04 13:32:47 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=185.153.199.187 DST=51.91.125.34>
Sep 04 13:32:57 vps-65dbc114 sudo[191565]:   ubuntu : TTY=pts/0 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/usr/bin/systemctl start apache2
Sep 04 13:32:57 vps-65dbc114 sudo[191565]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
Sep 04 13:32:57 vps-65dbc114 systemd[1]: Starting The Apache HTTP Server...
-- Subject: A start job for unit apache2.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit apache2.service has begun execution.
-- 
-- The job identifier is 54579.
Sep 04 13:32:57 vps-65dbc114 apachectl[191583]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 35 of /etc/>
Sep 04 13:32:57 vps-65dbc114 apachectl[191568]: Action 'start' failed.
Sep 04 13:32:57 vps-65dbc114 apachectl[191568]: The Apache error log may have more information.
Sep 04 13:32:57 vps-65dbc114 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit apache2.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Sep 04 13:32:57 vps-65dbc114 systemd[1]: apache2.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit apache2.service has entered the 'failed' state with result 'exit-code'.
Sep 04 13:32:57 vps-65dbc114 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: A start job for unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit apache2.service has finished with a failure.
-- 
-- The job identifier is 54579 and the job result is failed.
Sep 04 13:32:57 vps-65dbc114 sudo[191565]: pam_unix(sudo:session): session closed for user root
Sep 04 13:33:03 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=178.32.228.195 DST=51.91.125.34 >
Sep 04 13:33:04 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=178.32.228.195 DST=51.91.125.34 >
Sep 04 13:33:06 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=178.32.228.195 DST=51.91.125.34 >
Sep 04 13:33:10 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=178.32.228.195 DST=51.91.125.34 >
Sep 04 13:33:16 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=45.129.33.12 DST=51.91.125.34 LE>
Sep 04 13:33:18 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=178.32.228.195 DST=51.91.125.34 >
Sep 04 13:33:22 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=94.102.51.28 DST=51.91.125.34 LE>
Sep 04 13:33:26 vps-65dbc114 sshd[191590]: Received disconnect from 222.186.30.112 port 31892:11:  [preauth]
Sep 04 13:33:26 vps-65dbc114 sshd[191590]: Disconnected from 222.186.30.112 port 31892 [preauth]
Sep 04 13:33:38 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=45.129.33.82 DST=51.91.125.34 LE>
Sep 04 13:33:38 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=185.175.93.24 DST=51.91.125.34 L>
Sep 04 13:33:43 vps-65dbc114 sshd[191592]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.73 >
Sep 04 13:33:45 vps-65dbc114 sshd[191592]: Failed password for root from 112.85.42.73 port 61953 ssh2
Sep 04 13:33:48 vps-65dbc114 sshd[191592]: Failed password for root from 112.85.42.73 port 61953 ssh2
Sep 04 13:33:50 vps-65dbc114 sshd[191592]: Failed password for root from 112.85.42.73 port 61953 ssh2
Sep 04 13:33:53 vps-65dbc114 sshd[191592]: Received disconnect from 112.85.42.73 port 61953:11:  [preauth]
Sep 04 13:33:53 vps-65dbc114 sshd[191592]: Disconnected from authenticating user root 112.85.42.73 port 61953 [preauth]
Sep 04 13:33:53 vps-65dbc114 sshd[191592]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.73  user=root
Sep 04 13:34:07 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=110.25.93.42 DST=51.91.125.34 LE>
Sep 04 13:34:08 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=45.129.33.82 DST=51.91.125.34 LE>
Sep 04 13:34:08 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=112.78.187.83 DST=51.91.125.34 L>
Sep 04 13:34:18 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=45.129.33.151 DST=51.91.125.34 L>
Sep 04 13:34:32 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=45.129.33.152 DST=51.91.125.34 L>
Sep 04 13:34:56 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=74.82.47.2 DST=51.91.125.34 LEN=>
Sep 04 13:35:15 vps-65dbc114 sudo[191595]:   ubuntu : TTY=pts/0 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/usr/sbin/ufw desable
Sep 04 13:35:15 vps-65dbc114 sudo[191595]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
Sep 04 13:35:15 vps-65dbc114 sudo[191595]: pam_unix(sudo:session): session closed for user root
Sep 04 13:35:15 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=185.176.27.174 DST=51.91.125.34 >
Sep 04 13:35:35 vps-65dbc114 sshd[191597]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.73 >
Sep 04 13:35:36 vps-65dbc114 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:4d:23:f9:ee:cd:c1:81:18:88:08:00 SRC=210.14.96.118 DST=51.91.125.34 L>
Sep 04 13:35:37 vps-65dbc114 sshd[191597]: Failed password for root from 112.85.42.73 port 19211 ssh2
Sep 04 13:35:39 vps-65dbc114 sshd[191597]: Failed password for root from 112.85.42.73 port 19211 ssh2
Sep 04 13:35:43 vps-65dbc114 sshd[191597]: Failed password for root from 112.85.42.73 port 19211 ssh2
Sep 04 13:35:43 vps-65dbc114 sshd[191597]: Received disconnect from 112.85.42.73 port 19211:11:  [preauth]
Sep 04 13:35:43 vps-65dbc114 sshd[191597]: Disconnected from authenticating user root 112.85.42.73 port 19211 [preauth]
Sep 04 13:35:43 vps-65dbc114 sshd[191597]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.73  user=root
Sep 04 13:35:57 vps-65dbc114 sudo[191599]:   ubuntu : TTY=pts/0 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/usr/sbin/ufw disable
Sep 04 13:35:57 vps-65dbc114 sudo[191599]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
Sep 04 13:35:57 vps-65dbc114 sudo[191599]: pam_unix(sudo:session): session closed for user root

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi @k0ala Can you post the file here /etc/apache2/sites-enabled/000-default ?

I looked up some issues online and reinstalled things and it worked, my website was working. But now comes another issue which I don’t think is a droplet issue but everytime I type “node site.js” I get this long error


[2017-06-26 15:54:00.991] [INFO] [default] - DB Connection ID: 399
[2017-06-26 15:54:00.994] [INFO] [default] - DB Connection ID: 400
[2017-06-26 15:54:00.995] [INFO] [default] - DB Connection ID: 401
[2017-06-26 15:54:00.997] [INFO] [default] - DB Connection ID: 402
[2017-06-26 15:54:01.002] [TRACE] [default] - Roll 4263
[2017-06-26 15:54:01.003] [TRACE] [default] - Sucesfully updated history
[2017-06-26 15:54:01.004] [WARN] [default] - Loaded hashd8b710dfa2c8a3d990ca1dc7                                                                                           cc0a91754ac20aa6139fb7f6d44b58ee31ece8dc
[2017-06-26 15:54:01.134] [WARN] [default] - Loaded fresh prices
[2017-06-26 15:54:01.190] [WARN] [default] - Prices loaded from cache
[2017-06-26 15:54:03.934] [TRACE] [default] - Strange error
[2017-06-26 15:54:03.935] [DEBUG] [default] - { Error: listen EADDRINUSE :::8080
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at Server.setupListenHandle [as _listen2] (net.js:1305:14)
    at listenInCluster (net.js:1353:12)
    at Server.listen (net.js:1453:7)
    at Server.listen.Server.attach (/home/bot/node_modules/socket.io/lib/index.j                                                                                           s:237:9)
    at Timeout._onTimeout (/home/bot/site.js:618:29)
    at ontimeout (timers.js:488:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:283:5)
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 8080 }

It was working literally 10 minutes ago and now it doesn’t work

sorry for leaving @hansen, I was really tired and i went to bed… anyway

the site isn’t working and even after doing everything you said and then typing “service apache2 restart” it still said waiting, and I’m following a tutorial that requires you to type that command in order for the website to work… or else you get a 404 error and that’s exactly what’s happenening so no the site doesn’t work :/

@k0ala Okay, then you’ve just renamed or removed the file. Try running the following:

service apache2 start

service apache2 status
#press Q to exit the status dialog

@k0ala What are you confused by? The file? Do you have a backup of the file, then remove it. If not, then simply rename it. The server? Hire a system administrator to help you with the server.

@k0ala Getting a little narrow again, so starting a new thread

Can you remove or rename the file /var/www/.htaccess, which might be the reason. Rename command mv /var/www/.htaccess /var/www/.htaccess-OLD

@k0ala Just starting a new thread, since it was getting a little narrow.

My guess would be that this is your problem:

        <Directory />
                Options FollowSymLinks
                AllowOverride None      </Directory>

Which should look like this:

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

But I don’t understand why it says line 30 in the error, when this is clearly not line 30. Anyways, let’s edit the file with this command to make it look like the above:

nano /etc/apache2/sites-enabled/000-default

When you are done editing, hold CTRL key and press X key, release keys, press Y key and press Enter key.

Now restart Apache service apache2 restart.

This comment has been deleted