I setup virtualhost file in /etc/httpd/conf.d/vhost.com.conf
like the example
and check my file and addresses many times
<VirtualHost *:80>
ServerName www.vhost.com
ServerAlias vhost.com
DocumentRoot /var/www/html/vhost.com/public_html/
ErrorLog /var/www/html/vhost.com/logs/error.log
CustomLog /var/www/html/vhost.com/logs/access.log combined
</VirtualHost>
but my Apache doesn't start it show the following error:
[seconduser@VPS- ~]$ sudo systemctl status httpd.service -l
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2016-07-03 11:44:58 IRDT; 54s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 7214 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 7212 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 7212 (code=exited, status=1/FAILURE)
Jul 03 11:44:58 VPS- systemd[1]: Starting The Apache HTTP Server...
Jul 03 11:44:58 VPS- httpd[7212]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::250:56ff:fea3:6805. Set the 'ServerName' directive globally to suppress this message
Jul 03 11:44:58 VPS- systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 03 11:44:58 VPS- kill[7214]: kill: cannot find process ""
Jul 03 11:44:58 VPS- systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 03 11:44:58 VPS- systemd[1]: Failed to start The Apache HTTP Server.
Jul 03 11:44:58 VPS- systemd[1]: Unit httpd.service entered failed state.
Jul 03 11:44:58 VPS- systemd[1]: httpd.service failed.
as soon as i remove the vhost.com.conf
everything go back to normal and server run again in another configure i add this code to my vhost.com.conf
:
<VirtualHost *:80>
ServerName www.vhost.com
ServerAlias vhost.com
DocumentRoot /var/www/vhost.com/public_html/
ErrorLog /var/www/vhost.com/logs/error.log
CustomLog /var/www/vhost.com/logs/access.log combined
</VirtualHost>
and send this command sudo chmod -R 755 /var/www
and this sudo chown -R apache:apache /var/www/html/www.vhost.com
I don't know what do they I just saw them on internet.
EDIT- I checked my error log /var/log/httpd/error_log
and get this error : (13)Permission denied: AH00091: httpd: could not open error log file /var/www/vhost.com/logs/error.log.
AH00015: Unable to open logs
what can I do?
I do all of these because I need to seprate my subdomain.