Hosting external subdomain w/Apache on CentOS7?

April 7, 2018 328 views
Apache CentOS

I need some help. Im an amateur *nix user, playing around with things. I know enough to do the bare minimum of what I need to do, to host a telnt process.

I'm now branching out to try to add some simple web page hosting in my droplet, using an outside domain provider that I have a subdomain with, bjzbackup.custom-gaming.net

I followed the tutorial here: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7

I start out with the basic Apache default message, which is fine. But I'm trying to point the subdomain at the IP, and have the subdomain point to the appopriate directory.

I get to step 4 to create the virutal host. My virtual host is set up as follows:

<VirtualHost *:80>
ServerName bjzbackup.custom-gaming.net
DocumentRoot /var/www/bjzbackup/public_html
ErrorLog /var/www/bjzbackup/error.log
CustomLog /var/www/bjzbackup/requests.log combined
</VirtualHost>

I received no errors in enabling the symbolic link in step 5.

When I restart apache, I get the following error:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

When I look at the systemctl status, I get the following:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2018-04-07 21:25:52 UTC; 48s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 5454 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 5451 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 5451 (code=exited, status=1/FAILURE)

Apr 07 21:25:52 hotbmush-host systemd[1]: Starting The Apache HTTP Server...
Apr 07 21:25:52 hotbmush-host httpd[5451]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
Apr 07 21:25:52 hotbmush-host systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 07 21:25:52 hotbmush-host kill[5454]: kill: cannot find process ""
Apr 07 21:25:52 hotbmush-host systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 07 21:25:52 hotbmush-host systemd[1]: Failed to start The Apache HTTP Server.
Apr 07 21:25:52 hotbmush-host systemd[1]: Unit httpd.service entered failed state.
Apr 07 21:25:52 hotbmush-host systemd[1]: httpd.service failed.

Any help you guys can give would be appreciated. I don't think the stuff from the journal is relevant, but I can post it if need-be.

2 Answers

Do you have a cNAME in the DNS Zone file for the domain connected to the IP address of the hosting server?

  • I don't.; I'm not sure where I'd need to do that, if I have to at all? Note that I don't need the www portion of it to work, just the subdomain.

    I have the A record for the subdomain, pointing to the DNS of my droplet.

    Also, apparently my error.log isn't generating?

I figured it out. The tutorial does not account for write permissions; once I changed where the logs were writing to, it worked like a charm.

ErrorLog /var/log/httpd/mydomaincomerror.log
CustomLog /var/log/httpd/mydomaincomrequests.log combined

Those two worked for anyone who comes across this.

Have another answer? Share your knowledge.