Using Interia / Vue.js within XAMPP - laravel

After following the Laravel bootcamp that creates a small project called chirps, which works perfectly while using artisan on windows, when I try to access via apache in XAMPP, the inertia uris as defined below are not recognized in the browser
Route::get('/', function () {
return Inertia::render('Welcome', [
'canLogin' => Route::has('login'),
'canRegister' => Route::has('register'),
'laravelVersion' => Application::VERSION,
'phpVersion' => PHP_VERSION,
]);
});
This is config in my xampp/apache/conf/extras/httpd-vhosts.conf file.
<VirtualHost *:80>
DocumentRoot "{path}/public"
ServerName {projectName}.local
ServerAlias {projectName}.local
<Directory {path}/public>
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
The app.blade.php file is loaded as expected but as soon as you try to go to login / register it does not recognise them when running via apache, but work fine when running under artisan. Anyone got any ideas?

Related

Problem with Laravel, Apache and DigitalOcean (too_many_redirects)

I have a problem with my laravel project, I installed in DigitalOcean, all the instalacions work fine my Php, composer, postgresql all work fine.
I created my virtualhost in Apache like this.
``` <VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName hidrofracweb.com
ServerAlias www.example.com
DocumentRoot /var/www/hidrofrac/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/hidrofrac/public >
Require all granted
AllowOverride All
</Directory>
</VirtualHost>```
and in my project route are like this.
web.php
```Auth::routes();
Route::get('/home', 'HomeController#index')->name('home');
Route::get('/', 'Auth\LoginController#logout')->name('logout');
Route::post('departamentos/departamento', 'DepartamentoController#index')->name('departamento');
Route::post('usuarios/usuario', 'UsuarioController#index')->name('usuario');
Route::post('registroproducto', 'UsuarioController#guardartipopro');
Route::post('registroproubicaion', 'UsuarioController#guardartipoubicacion');
Route::post('usuarios/usuario', 'UsuarioController#index')->name('usuario');
Route::post('usuarios/gpproducto','UsuarioController#tproducto');
Route::post('registrausuario','UsuarioController#store');
Route::post('usuarios/permiso', 'UsuarioController#permisousuario');
Route::post('registrapermiso', 'UsuarioController#permisosuser');```
when I work in my local computer and open navigator I run my project like this.
http://localhost/hidrofrac/public/login
Works fine...
But when I run my project in my virtual machine with my ip, get this error.
page not working too many redirects
ERR_TOO_MANY_REDIRECTS
can someone help me please?

LARAVEL Failed to load resource: the server responded with a status of 404 (Not Found)

this is my set up for the projects:
<VirtualHost *:80>
ServerName www.basiclaravel.website
ServerAlias www.basiclaravel.website
DocumentRoot "C:\Users\Nancy\Documents\Projects\Backend\Laravel_10_Projects\BasicLaravelWebsite/public"
</VirtualHost>
the link http://www.basiclaravel.website/ is working,
http://www.basiclaravel.website/about or http://www.basiclaravel.website/contacts does not work, I am getting error message:
Not Found
The requested URL /contact was not found on this server.
Route set up:
Route::get('/', function () {
return view('home');
});
Route::get('/about', function () {
return view('about');
});
Route::get('/contact', function () {
return view('contact');
});
home, about, contact are in the same folder views.
if I set up about or contact for www.basiclaravel.website it is displayed.
Any idea what might be issue?
Another issue came up after I installed composer require
"laravelcollective/html":"^5.4.0"
any of my css or bootstrap code is working, the page is clean in HTML only
thanks in advance
Try to access the pages via index.php, for example http://www.basiclaravel.website/index.php/contact for the contact page.
If that works, either you don't have mod_rewrite installed and/or enabled as per the documentation, or your Apache config is setup to prevent overrides by the Laravel .htaccess file.
Update your virtual host as follows:
<VirtualHost *:80>
ServerName basiclaravel.website
ServerAlias www.basiclaravel.website
DocumentRoot "C:/Users/Nancy/Documents/Projects/Backend/Laravel_10_Projects/BasicLaravelWebsite/public"
<Directory "C:/Users/Nancy/Documents/Projects/Backend/Laravel_10_Projects/BasicLaravelWebsite">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Restart Apache for the settings to take effect, and the .htaccess should now work.

Dynamic subdomain Laravel

I want to know, how to create dynamic subdomain with laravel 5.6 and wampserver
My code in web route for test
Route::group(array('domain' => '{subdomain}.test.local'), function () {
Route::get('/', function ($subdomain) {
$name = DB::table('users')->where('username', $subdomain)->get();
dd($name);
});
});
I do one parameter on my vhost and httpd-vhosts. After I added alias name. Result here
<VirtualHost *:80>
ServerName test.local
ServerAlias *.test.local
DocumentRoot "c:/wamp64/www/test"
<Directory "c:/wamp64/www/test/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
</VirtualHost>
In my browser I try to use test.test.local for try if subdomain is correct but doesn't work.
Note: I would like to have variable subdomain
Thank you for your answer

Routing error in laravel

I'm trying to build a web app in laravel 5.2 on windows platform with wamp server installation.
I'm trying to call a dashboard page by following routes:
Route::get('nitsadmin/dashboard', function () {
return view('nitsadmin.dashboard');
});
Following is the route list:
where my file structure is as below:
My virtual host configuration in httd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "c:\wamp\www\nitsedit\public"
ServerName nitseditor.dev
</VirtualHost>
Apache alias:
Alias /nitseditor.dev "C:/wamp/www/NitsEdit/public"
<Directory "C:/wamp/www/NitsEdit/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
Don't know where I'm getting problem but I'm getting following error:
You have wrong web server configuration, just point web server to a public directory in Lararel project root and restart web server.
You're using the wrong URL, ditch the "nitsedit\public" part:
http://nitseditor.dev/nitsadmin/dashboard
Apache is already pointing the user to the public folder.
Just commented out Include conf/extra/httpd-vhosts.conf in the file httpd.conf present in folder wamp/bin/apache/apache2.4.9/conf and it worked.

Laravel 4 pretty urls

Ok I was working on a project using laravel 4. I never bothered setting up vhosts for pretty urls. I was just using localhost/myapp/public...
Everything was working fine. Now I have decided to set up vhosts. And I'm getting the following error when $user->save(); is called:
ReflectionException
Class confide.repository does not exist.
Auto-loading is not working why??
What am I forgetting??
Here is my vhost.conf set up:
<VirtualHost 127.0.0.6>
DocumentRoot "C:\xampp\htdocs\myapp\public"
ServerName myapp.dev
<Directory "C:\xampp\htdocs\myapp\public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
</Directory>
</VirtualHost>
And my hosts setup:
127.0.0.6 myapp.dev
UPDATE: when I configure vhosts with: ServerName myapp instead of ServerName myapp.dev
It works great, however I want the .dev so that that I can use facebooks api.
Any help greatly appreciated.
I see you're on a Windows machine.
VHosts (Windows) related:
I'm using vhosts myself. Here's a copy of what I'm using in my WAMP Environment:
# Virtual Hosts Settings
NameVirtualHost *:80
<VirtualHost *:80>
ServerName appdomain.local
DocumentRoot "D:/Program Files/wamp/www/appname"
ErrorLog "D:/Program Files/wamp/www/appname/server_logs/errors.log"
TransferLog "D:/Program Files/wamp/www/appname/server_logs/access.log"
</VirtualHost>
…and in the hosts file I use:
127.0.0.1 appdomain.local
Try these settings and see if it works.
BTW.: Why are you using 127.0.0.6? Localhost is equal to 127.0.0.1... To use another IP some other settings need to be set / adjusted in Windows.
Laravel 4 related:
Have you checked the User model and composer.json file?
Did you follow the necessary installation instructions on https://github.com/Zizaco/confide#quick-start ?
Double check that.
Also look at this: https://github.com/Zizaco/confide/issues/9
About my App/Config/app.php config file:
I've setup a "production" and "local" app config. The main differences for the local version are:
- debug => true (production => false)
- url => THE_APP_LOCAL_DOMAIN (production => THE_APP_DOMAIN)
Everything else is set in the production config.
Providers example:
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
...,
),
Aliases example:
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Carbon' => 'Carbon\Carbon',
...,
),
I always update the autoload (> composer dump-autoload) on:
namespace changes
composer.json edits
composer updates (e.g. after adding a new package from like packagist)
and config changes, just to be save
Also try the following commands: (don't forget to cd to the project directory first)
composer dump-autoload
php artisan dump-autoload
php artisan cache:clear

Resources