php


Why I can't correctly deploy this Laravel web site on my remote Linux server? Is it a virtual host configuration issue?


I am very new in PHP and moreover in Laravel (I came from Java) and I am going totaly crazy trying to correctly deploy a Laravel 5.4 projects that works fine in my XAMPP local environment on my Linux server. The problem should be related to virtual host configuration but I can't find a solution also asking question and reading documentation.
In my local environment (I am using XAMPP on Windows) I have setted this virtual host into the C:\xampp\apache\conf\extra\httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/HotelRegistration/public"
ServerName laravel.dev
</VirtualHost>
So opening the laravel.dev URL I obtain the standard Laravel homepage (I have yet not replaced it with a landing page).
Then if I open this URL: http://laravel.dev/registration
I obtain the user registration page developed by me, this because I have this route into my web.php file into my project:
Route::resource('/registration', 'RegistrationController');
Then into my RegistrationController.php there is this method showing the resources/views/registration/index.blade.php view
public function index(){
return view('/registration/index');
}
In local environment, with the laravel.dev vhost pointing to the document root of my Laravel website, it works fine.
Now I have uploaded this Laravel website into my remote Linux server, into this folder: /var/www/html/HotelRegistration
But now my problem is that in this remote environment I had not virtual host (correct me if I am doing wrong assertion: from what I have understand the virtual host is used on the local environment to simulate a domain that Laravel need to point to the public folder, is it this reasoning correct?)
Anyway, this is the URL of the public folder of my deployed web site on my remote server:
http://89.36.211.48/HotelRegistration/public/
As you can see opening it the Laravel landing page is correctly shown, the problem is that I can access to the previous registration page, the only way that I have found is to open this URL:
http://89.36.211.48/HotelRegistration/public/index.php/registration
but it is pretty horrible and above all when the registration form is submitted it is generated a POST request toward this URL http://89.36.211.48/registration that end into a 404 Not Found error.
In the past I explained the situation here: What is wrong in the deploy of this Laravel application? Need I an effective domain instead the vhost used on my local environment?
but now I have do some changes to my Apache configuration followint the suggestion given in the previous post (adapting the answer to my folder structure).
So into this Apache folder /etc/apache2/sites-available I created and enabled the laravel.dev.conf related to my new vhost, having this configuration:
<VirtualHost *:80>
ServerAdmin mymain#gmail.com
ServerName 89.36.211.48
ServerAlias www.laravel.dev
DocumentRoot /var/www/html/HotelRegistration/public/
ErrorLog /var/www/html/HotelRegistration/storage/logs/error.log
CustomLog /var/www/html/HotelRegistration/storage/logs/access.log combined
<Directory /var/www/html/HotelRegistration/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
The path are related to where this website is installed on my remote server I am absolutly not sure if these configuration are ok, expecially about the ServerName value (I put here the IP of my server, is it correct?)
Then I enabled this virtual host using this statment:
sudo a2ensite laravel.dev.conf
and I restart apache.
Ok, the problem now is: what have I to do to correctly access to this website?
I still have the same problem, that is:
I still access to the Laravel landing page by this URL: http://89.36.211.48/HotelRegistration/public/
I still access to the registration form page by the horrible URL: http://89.36.211.48/HotelRegistration/public/index.php/registration
Submitting the form I still go to http://89.36.211.48/registration and obtain the same 404 Not Found error page.
So my doubts are:
Is it the virtual host correctly configured?
If it is correct what have I to do to correctly access to this web site? Need I a domain (if yes: what have to point this domain?) or can I use a path into my server in some way (something like: http://89.36.211.48/HotelRegistration/)
I am expanding my comment here.
Set folder structure like on image:
In index.php change paths like this:
line 22
require __DIR__.'/system/bootstrap/autoload.php';
line 36
$app = require_once __DIR__.'/system/bootstrap/app.php';
Thats all what I do when transferring Laravel app to server (and changing .env for database). Sometimes I have to change permissions for storage folders but thats it.

Related Links

How to create a dynamic loop for Excel creation in PHPExcel through PHP
PHP MVC - How exactly do I use views?
How to display user logged in, directly on the homepage
REST API design with HMAC: How to handle security on first user registration
Zend Framework. controller before action method
Should a switch statement be used this way? [closed]
How to access a variable from the model in view (Yii framework)?
Printing an HTML table, based on available rooms in a booking system
Multiple return types of in a method?
Cannot use a constant IV key and a produced ENCRYPT_KEY in php mcrypt
PHP includes working into dev, but not into prod
Redirect misinterpret route
is there anyway to call function from website1 to website2
phpdoc for inherited method
Trying to preg_split uppercases and numbers
HTTP_REFERER to location Iframe?

Categories

HOME
opengl
rust
openshift
entity-framework
android-studio
plesk
adfs3.0
d3.js
long-integer
foaf
haproxy
histogram
android-emulator
celery
dronekit-python
malware
jint
sympy
hystrix
fireloop
erd
business-intelligence
grocery-crud
createjs
outlook-restapi
mixpanel
jqxgrid
hidden
error-logging
android-permissions
kaggle
perfino
pyopencl
tracing
beego
hdmi
list-comprehension
marquee
math.js
macromedia
ibm-connections
dnsmasq
objectmapper
windows2012
commonsware-cwac
actframework
lxml
quickcheck
testlink
netapp
icepdf
git-tfs
reverse-dns
gestures
subforms
webvtt
rustdoc
d3v4
finder
fuzzer
dmarc
svnserve
qpixmap
mnesia
cortana
perceptron
postal-code
unidata
jolie
image-rotation
tabris
lmax
webautomation
code-complexity
xmi
boolean-algebra
vlab
jquery-transit
acceptance-testing
email-verification
jquery-dialog
viewpagerindicator
system-information
taskkill
netstream
django-apps
dip
pyjamas
eaccelerator
jdownloader
outlook-2007-addin
tessellation
getimagesize
rational-unified-process
dm
html-components
gtktextview

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App