我之前在这里看到过这个常见问题的讨论,并尝试了所有方法,但都不起作用。就像无法启动 Apache HTTP 服务器和https://superuser.com/questions/1522288/failed-to-start-the-apache-http-server
尝试
- 我已经更改了 Apache 的端口,以防在重复端口上运行,但它仍然不起作用。
- 我尝试再次安装 Apache 但仍然不起作用。
我不知道还能看什么
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Fri 2020-07-10 11:09:56 +07; 12min ago
៧ 10 11:09:56 moniroth-ThinkPad-T450s systemd[1]: Starting The Apache HTTP Server...
៧ 10 11:09:56 moniroth-ThinkPad-T450s apachectl[969]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enable
៧ 10 11:09:56 moniroth-ThinkPad-T450s apachectl[969]: Action 'start' failed.
៧ 10 11:09:56 moniroth-ThinkPad-T450s apachectl[969]: The Apache error log may have more information.
៧ 10 11:09:56 moniroth-ThinkPad-T450s systemd[1]: apache2.service: Control process exited, code=exited status=1
៧ 10 11:09:56 moniroth-ThinkPad-T450s systemd[1]: apache2.service: Failed with result 'exit-code'.
៧ 10 11:09:56 moniroth-ThinkPad-T450s systemd[1]: Failed to start The Apache HTTP Server.
编辑:运行命令后apachectl configtest
我收到此消息
apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enabled/your_domain.com.conf: /etc/apache2/sites-enabled/your_domain.com.conf:1: <VirtualHost> was not closed. Action 'configtest' failed. The Apache error log may have more information.
以下是我的你的域名.com.conf文件
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/opencart/
ServerName opentcart.com ServerAlias www.opencart.com <Directory /var/www/html/opencart/> Options FollowSymlinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
答案1
虚拟主机配置文件需要重新修改
从
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/opencart/
ServerName opentcart.com ServerAlias www.opencart.com <Directory /var/www/html/opencart/> Options FollowSymlinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
到
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/opencart/
ServerName opentcart.com
ServerAlias www.opencart.com
<Directory /var/www/html/opencart/>
Options FollowSymlinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>