【发布时间】:2016-12-24 00:15:36
【问题描述】:
我检查了大多数关于我的问题的问题,因为这对于 Laravel 初学者来说似乎是非常常见的错误,但到目前为止我找不到解决方案:(
我用的是数字海洋VPN,centos7,php5.6,apache,windows 10。
安装 laravel 并配置 httpd.conf、mysite.com.conf、.htaccess 和 hosts 文件然后重新启动 apache,但仍然不显示欢迎屏幕,而是显示 apache 屏幕。
+================================================ ====+
这是我的设置...
1) /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
Options -Indexes +FollowSymLinks
AllowOverride None (default setting)
并在文件末尾添加
ServerSignature Off
ServerTokens Prod
IncludeOptional sites-enabled/*.conf
其他默认设置如下,仅供参考
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
2) /etc/httpd/sites-available/mysite.com.conf
<VirtualHost *:80>
ServerAdmin admin@mysite.com
ServerName mysite.com
ServerAlias mysite.com
DocumentRoot /var/www/mysite.com/public_html
ErrorLog /var/log/httpd/mysite.com_error_log
CustomLog /var/log/httpd/mysite.com_access_log combined
AddDefaultCharset UTF-8
<Directory /var/www/mysite.com/public_html>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
AllowOverride All
</Directory>
</VirtualHost>
3) /var/www/mysite.com/public_html/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
4) C:/windows/system32/drivers/etc/hosts
digitaloceanDropletIp mysite.com
如果有人能告诉我我的设置出了什么问题,我将不胜感激。 提前致谢!
【问题讨论】:
-
我认为在这个
<Directory "/var/www/html">中将/var/www/html更改为/var/www/mysite.com/public_html/ -
感谢您的回复@jaysingkar,我刚试过但仍然显示 apache 屏幕 :(
-
@hasmai 你后来重启了 apache2 吗?
-
嗨@jrenk,是的,我做了'sudo apachectl restart'和'sudo service httpd restart'。但没有运气:(
-
@RadLexus 做到了并欢呼
标签: apache laravel-5.2 httpd.conf digital-ocean centos7