0

I asked a question earlier on how to get an ssl certificate on a service I'm running. Question asked here.

Now I have my domain linked to my server and I can connect to my apache with ssl enabled. So I wanted to enable the reverse proxy that was posted as a solution.

I followed this guide to set up my apache server as a proxy. When I try to start the apache service, I get the following error;

● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: inactive (dead) since Die 2017-04-25 20:57:59 CEST; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 25802 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 25377 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
  Process: 25786 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

Apr 25 20:57:59 Valhalla apache2[25786]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:8002
Apr 25 20:57:59 Valhalla apache2[25786]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8002
Apr 25 20:57:59 Valhalla apache2[25786]: no listening sockets available, shutting down
Apr 25 20:57:59 Valhalla apache2[25786]: AH00015: Unable to open logs
Apr 25 20:57:59 Valhalla apache2[25786]: Action 'start' failed.
Apr 25 20:57:59 Valhalla apache2[25786]: The Apache error log may have more information.
Apr 25 20:57:59 Valhalla apache2[25786]:  *
Apr 25 20:57:59 Valhalla apache2[25802]:  * Stopping Apache httpd web server apache2
Apr 25 20:57:59 Valhalla apache2[25802]:  *
Apr 25 20:57:59 Valhalla systemd[1]: Started LSB: Apache2 web server.

This is my apache config file;

<VirtualHost *:80>
        Servername novinav.com
        Redirect temp / https://novinav.com/
</VirtualHost>

<VirtualHost *:443>
        ServerAdmin kkalera@gmail.com
        DocumentRoot /var/www/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine On
        SSLCertificateFile /etc/ssl/certs/novinav_com.crt
        SSLCertificatekeyFile /etc/ssl/certs/novinav.com.key
        SSLCertificateChainFile /etc/ssl/certs/novinav_com.ca-bundle
        ProxyPreserveHost On
        #servers to proxy the connection, or list of application servers usage
        ProxyPass / http://192.168.0.102:8002/
        ProxyPassReverse / http://192.168.0.102:8002/
        ServerName Valhalla
</VirtualHost>

I think it has something to do with the fact that the service I'm running is already listening to the same port. Is it possible to have apache listen on a different port (for instance 8003) and then proxy to 8002?

1 Answers1

0

I found the solution. I removed port 8002 from the apache ports.conf file and commented out the line "DocumentRoot /var/www/".

Now when I connect to the website I get the proxy'd service.