我有一個Ubuntu機器上我想運行一個PHP休息服務器。這裏是我的默認配置文件:與apache2服務php RESTful服務器(Ubuntu的)
ServerName localhost
<VirtualHost *:80>
DocumentRoot /var/www/html/otherSite
ServerName www.vlio20_paka.com
Alias /otherSite /var/www/html/otherSite
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/lbserver/public
ServerName www.vlio20_lb.com
Alias /lbServer /var/www/lbserver/public
<Directory /var/www/lbserver/public>
AllowOverride all
DirectoryIndex index.php
Require all granted
</Directory>
</VirtualHost>
在我的公開目錄我有.htaccess文件:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
</IfModule>
當我嘗試訪問我越來越未找到錯誤的服務器http://MACHINE_IP/lbServer
。
我該如何讓它工作 (我在配置文件中每次更改後都要重啓apache)?
更新:
生產apache2 -t
:
[Sun Jun 28 12:00:00.789522 2015] [core:warn] [pid 22089] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sun Jun 28 12:00:00.789835 2015] [core:warn] [pid 22089] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sun Jun 28 12:00:00.789970 2015] [core:warn] [pid 22089] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sun Jun 28 12:00:00.790088 2015] [core:warn] [pid 22089] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sun Jun 28 12:00:00.790240 2015] [core:warn] [pid 22089] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Jun 28 12:00:00.794721 2015] [core:warn] [pid 22089:tid 140102153521024] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Jun 28 12:00:00.795136 2015] [core:warn] [pid 22089:tid 140102153521024] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Jun 28 12:00:00.795200 2015] [core:warn] [pid 22089:tid 140102153521024] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
注:第一個網站加載不錯,但第二給出了一個404錯誤。
重啓你的apache服務器的命令是'sudo service apache2 restart'。只需重新加載你的配置('重新加載'而不是'重新啓動')也可能工作,並且稍微快一點。 – tarleb
我做了兩個,sudo服務apache2重新加載&sudo服務apache2重新啓動 – vlio20
這意味着除非這些命令處理了錯誤消息,否則您的配置是有效的。請注意,Ubuntu系統中沒有'httpd'二進制文件,它被稱爲'apache2',通常不應直接調用。 – tarleb