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 return 0 instead of null in Laravel
how to prevent directly enter in URL and browser refresh button when using onbeforeunload function
How to check entered url is indexing on google or not using php
how to move an image from folder and resize before saving to another folder?
multi items setup in PayPal php sdk
Codeigniter Image upload issue
Cannot insert values in database tables
Editing data in multiple columns from front-end
mpdf watermark - inclined to vertical
how to convert a json data according to requirement?
error creating dynamic events and ykeys in morris line chart
How to display jQuery variables value in PHP on the same page?
Check a 2D associated array for a string, return the information (PHP)
single-{post-type}.php is not working in wordpress
Multiple post parts in same page
PHP Method Chaining without writing lots of return this

Categories

HOME
qt
keyboard
jms
schema.org
subdomain
celery
dronekit-python
tcp
amp
tfs2015
flurry
ipv6
ui-automation
mithril.js
wagtail
scheduler
kurento
tup
wine
siesta
migrate
cqrs
texas-instruments
asp.net-core-1.0
bnf
pywinauto
user-defined-types
error-logging
akka-persistence
quantitative-finance
substring
web-config-transform
data-collection
ruby-daemons
onchange
python-imageio
pyspark-sql
adapter
bonita
copy-protection
infopath2010
plantuml
microsoft-certifications
advanced-filter
apptentive
restful-architecture
textmate2
subclassing
microsoft-ui-automation
hypothesis-test
react-intl
autorelease
simple-schema
popen
mpmovieplayercontroller
business-rules
msg
tablespace
fragmentstatepageradapter
declarative
polymerfire
cortana
opencyc
directx-9
srv-record
knife
search-form
abstract-factory
mgwt
dos2unix
ildasm
jquery-mobile-flipswitch
webautomation
senchatouch-2.4
semicolon
ntlmv2
ckeditor.net
simplecov
daap
idispatch
viewpagerindicator
monocross
groovy-console
kohana-auth
libxslt
activestate
getimagesize
jquery-effects
inversion
rakudo
twitter-feed
suggestbox
downloadfile

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App