[英]Laravel Develoyment on AWS EC2
我正在嘗試在 AWS EC2 雲服務器上部署 laravel 5.1 項目,但遇到了 laravel 網站路由 URL 的問題。
我運行以下命令來配置 EC2 ubuntu 14.04 LTS 服務器。
sudo apt-get install apache2
sudo apt-get install mysql-server php5-mysql
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo apt-get install php5 php-pear
sudo apt-get install curl php5-curl php5-cli git
sudo a2enmod rewrite
sudo php5enmod mcrypt
sudo service apache2 restart
當我嘗試訪問任何路由 URL 但我的主頁加載正確時出現以下錯誤。
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /register was not found on this server.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at xxxx.ap-southeast-2.compute.amazonaws.com Port 80
</address>
</body></html>
我已將 apache 路由 URL 更改為我的 laravel 項目的公共文件夾,但沒有成功。 我也嘗試啟用以下虛擬主機文件,但仍然出現相同的錯誤。
<VirtualHost *:80>
ServerAdmin webmaster@mynewhost.com
DocumentRoot /var/www/html/mynewhost/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我運行以下命令來授予存儲文件夾的權限
chmod -R 777 storage
我需要為我的 Laravel 項目文件夾授予任何權限嗎?
感謝任何幫助。
這是我在 Ubuntu 14.04 上對 Laravel 5.1 的配置
您可能需要啟用重寫引擎
sudo a2enmod rewrite
如果這不起作用,您可以將虛擬主機配置更改為這樣的
<VirtualHost *:80>
ServerName laravel.example.com
DocumentRoot /var/www/html/mynewhost/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/mynewhost/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
另外將 ServerName 添加到/etc/hosts
<your-server-ip-address> laravel.example.com
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.