douluan5738 2019-05-22 13:53
浏览 68

无法使用子域GoDaddy,AWS和Routes部署Laravel 5.2

It is NOT on a Shared Server (cPanel)

What am I doing wrong? I have an application in Laravel 5.2 with two areas (BackEnd and FrontEnd), which works correctly locally, defining Virtual Host, but when I try to deploy to a production server, it shows a blank page. The domain is in GoDaddy with two subdomains pointing to an Ubuntu 18 Server in AWS (php 5.6).

Any idea why it does not redirect to direct routes? I appreciate any help.

site.mydominio.com Redireccionado a http://ipserveramazon/vouchervalidation/public admin.mydominio.com Redireccionado a http://ipserveramazon/vouchervalidation/public

app\httpoutes.php

Route::get('/', function () {
return redirect()->route('home.index');

//die('Working');
});
Route::get('/frontend', function () {
return redirect()->route('home.index');
});
Route::get('/backend', function () {
return redirect()->route('dashboard.index');
});

Routes FrontEnd:

Route::group(['namespace' => 'Modules\Frontend\Http\Controllers',
'domain'     => 'site.'.getenv('HOST_NAME'), 'middleware' => ['web']],
function(){
Route::get('/', 'HomeController@index');

Route::any('/', function(){
return redirect()->route('home.index');
});

Route::group(array('prefix' => 'home'), function(){
Route::get('index', array('as' => 'home.index', 'uses' =>
'HomeController@index'));
});
...
});

Routes BackEnd:

Route::group(['namespace' => 'Modules\Backend\Http\Controllers',
'domain' => 'admin.'.getenv('HOST_NAME'), 'middleware' =>
['web','auth']], function(){

Route::get('backend', array('as' => 'backend.index', 'uses' =>
'BackendController@index'));
Route::get('dashboard', array('as' => 'dashboard.index', 'uses' =>
'DashboardController@index'));

Route::group(array('prefix' => 'dashboard'), function(){
Route::get('get-documents-chart/{year}', array('as' =>
'dashboard.get-documents-chart', 'uses' =>
'DashboardController@getDocumentsChart'));
});
…
});

*.htacess file in public folder : *

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On
RewriteBase /var/www/html/vouchervalidation/public/
   # change above to your site i.e.,  RewriteBase /whatever/public/

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
*apache2.conf file in /etc/apache2 : *

ServerName localhost

Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf

<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/html/vouchervalidation/public>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
*000-default.conf in etc/apache2/sites-enabled : *

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/vouchervalidation/public
<Directory /var/www/html/vouchervalidation/public>
Allowoverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost site.protelcotelsa.com:80>
ServerAdmin webmaster@localhost
ServerName site.protelcotelsa.com
ServerAlias site.protelcotelsa.com
DocumentRoot /var/www/html/vouchervalidation/public
<Directory /var/www/html/vouchervalidation/public>
Allowoverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost admin.protelcotelsa.com:80>
ServerAdmin webmaster@localhost
ServerName admin.protelcotelsa.com
ServerAlias admin.protelcotelsa.com
DocumentRoot /var/www/html/vouchervalidation/public
<Directory /var/www/html/vouchervalidation/public>
Allowoverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I tried the following:

sudo a2enmod rewrite

sudo chgrp -R www-data storage bootstrap/cache

sudo chmod -R ug+rwx storage bootstrap/cache

I tried passing the contents of the public folder to / var / www / html / and editing the files index.php, .htacess, resulting in the same problem.

composer install --optimize-autoloader --no-dev

php artisan config:cache

php artisan route:cache

php artisan vendor:publish

sudo a2dissite 000-default.conf

sudo a2ensite 000-default.conf

I changed the ubuntu server to 14.04, resulting in the same problem as the blank page.

add die('Working'); to routes and good

http://3.14.103.54/vouchervalidation/public/index.php/frontend (same problemt)

http://3.14.103.54/vouchervalidation/public/index.php/backend (same problemt)

...

but without results, your help, please

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 下图接收小电路,谁知道原理
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度