Laravel installation on NGINX - laravel

I've created a droplet in www.digitalocean.
I've installed NGINX, PHP5 and MYSQL. So far so good.
I've setup Nginx Server Blocks (Virtual Hosts):
zzzz.com
If I go to the browser and type zzzz.com it will display what I have in:
/var/www/zzzz.com/html/index.html
But now I've added Laravel. And supposedly I should see the laravel home page when I go to my http:// server_name
Can anyone help me please.

Related

Openlitespeed 301 Moved Permanently problem

I have a new Openlitespeed server on Ubuntu, I have 2 domains pointing to the same IP,
I tried to make a multidomain server so that www.domain1.com would point to one website and www.domain2.com to another.
I followed this tutorial.
Now when I go to domain1.com:80 it returns "CERR_CONNECTION_TIMED_OUT" and if I look at the network tab it shows:
and redirects me to http://domain1.com:8080/
If I go to domain2.com:80 it's the same but it redirects me to 8088.
Before that, I was hosting two testing pages on 8080 and 8088, but I changed all the settings and can't find what is causing the redirections... (both websites are wordpress)
I managed to resolve this, something inside WordPress was redirecting.
I re-downloaded new WordPress and now it works.

Route is not working when I access laravel application through localhost

I have a laravel project and I can access this application through virtual server (tracking.com) locally. When I run through virtual server all the routes are working perfectly. But when I access the application through localhost (localhost/tracking/public) routes are not working except home page.
Home Route
Route::get('/', 'DashboardController#info')->middleware('auth');
Non-working routes
Route::resource('depot', 'DepotsController')->middleware('auth')
All routes are working well with virtual server. With virtual server both routes are working home page(tracking.com) and depots page (tracking.com/depot).
but with localhost only (localhost/tracking/public) is working and (localhost/depot) is not working.
There are three solutions to this issue -
1) If you have Apache or Nginx installed, configure your vhost to point to /public/ directly
2) Use Laravel Homestead
3) Navigate to your project-folder/ within your terminal and run php artisan serve, you can now browse to http://localhost:8000 directly in your browser
Ref: If you are going with the first approach - Click here
use php artisan serve and navigate to 127.0.0.1:8000 from they all the routes will work

Laravel version: 5.4.28 api routes not working on localhost

I downloaded Laravel 5.4.28 and created one api route. Nothing works on localhost. I am using XAMPP on Windows 8.1 as local development.
But everything is working fine on server. I also notice one strange thing. It will work on localhost if I create virtual host on localhost. like below.
php artisan serve
Is that true? or Am I missing anything?
My api routes are like this...
http://localhost:1234/adminapi/public/api/v1/authenticateuser
If your XAMPP works normally with normal PHP pages, did you check which version of php XAMPP uses ? the minimum required version is
PHP >= 5.6.4
Laravel Official Website
The default version of XAMPP's PHP framework is 5.6.30
I have faced the same problem, it turned out that I had only problem with PHP version I just upgraded the version of php.ini from 5.6.3 to 7.0.1 new versions of XAMPP have them both !
First of all you need to create virtual host for your project like yourprojectname.local. and test your app through this url.If you not create virtualhost then you need to give whole path for access laravel api like localhost/yourprojectdirectory/public/adminapi/public/api/v1/authenticateuser
You can bellow link refer to the creating virtual host
http://foundationphp.com/tutorials/apache_vhosts.php
OR
How To Set Up Apache Virtual Hosts on XAMPP (Windows)
When you do php artisan serve and load the URL returned by that command do you see laravels welcome page? If not then you haven't installed it correctly. https://laravel.com/docs/5.4
The php artisan serve command doesn't create a virtual host, it is just a shortcut for the PHP Builtin Webserver, something PHP has out of the box, so the point of using it is to start testing your application as fast as you could, you just need to install PHP, Composer and your application is up (if you don't need anything else, of course). But if you already have Nginx installed, there is no point at all, just use it.
It's not wise to use the Builtin Webserver in production.
There's a property in config/app.php called url.
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
By default it links to .env file's property called APP_URL. XAMP usually requires you to navigate to localhost/project_folder before you can even access your project, hence why you need to set your url property to the one you're using.
Second, API routes usually are prefixed with /api/ and do require a X-REQUESTED-WITH: XMLHttpRequest header.
If you install fresh laravel app, you base api prefix must be equal api.
you route in api.php
Route::get('test', 'TestController#test');
If now you run php artisan serve command, api will be available to
localhost:8000/api/test.
Hope, I help you.
I was facing the same with Apache on Windows. Following the next steps below, it worked for me.
First, look for your file httpd.conf into Apache.
Find the section...
<Directory /var/www/>
Change
AllowOverride None
to
AllowOverride All
Finally, restart the Apache service.

error when accessing laravel project in ubuntu server 16.04

I have problem when i try to access my webapp in my ubuntu server 16.04..
when i try to type my server ip with the laravel folder it showing this message,
The requested URL /laravel_spk-matautama/home was not found on this server.
but then i try to put index.php on my link like this url
http://xxx.xxx.xxx.xxx/laravel_spk-matautama/index.php/home
it works, but the problem is it wont embed the masterpage layout.
Do like this, to access your home page
http://xxx.xxx.xxx.xxx/laravel_spk-matautama/public

CodeIgniter project shows 404 error in nginx server

I have a Codeigniter project which is already created in XAMPP server and its working fine.For some reason, my client wants to shift it to Nginx server. In Nginx server, only default controller is loading.the other pages are showing 404 error. Is there anything I need to setup in Nginx server.I have an another Codeigniter project which is working perfectly in Nginx server.
Is there anything I have to change in my Codeigniter file
I have tried with
http://localhost/Project1/website_progressing/ this is working fine
home.php is my default controller which shows 404 error
http://localhost/Project1/website_progressing/home

Resources