how to configure laravel site on localhost using xampp - laravel-5

I am trying to configure the site in localhost which is developed on laravel.
Now I am trying to configure it on my local Machine, using xampp version 3.2.1 and php version 5.6.11 & mysql DB.
I am able to configure it but other than home page all links get 404 page not found error
any suggestions

Enable the rewrite_module in apache's configuration file.
If you are not aware of how to do this, follow below steps:
1) Open apache's configuration file using your favorite text editor. The configuration file generally locates at:{apache_dir}/conf/httpd.conf
If you are using XAMPP or WAMP package then you will find the file at:{xampp_dir}/apache/conf/httpd.conf (or)
{wamp_dir}/apache/conf/httpd.conf
2) Search for the following string:#LoadModule rewrite_module modules/mod_rewrite.so and uncomment it (remove the '#' sign).
3) Now search for another string AllowOverride None and replace it by AllowOverride All
4) Finally save the changes, close your text editor and restart your apache server.
Hope this will help you, Thank you.

Related

Codeigniter 4.0.4 redirecting to 404 - File Not Found

Why I got 404 - File Not Found when I run CI.
I am using xampp 8.0.0, I already put my CI folder to htdocs and also I've changed the config/app baseurl to http://localhost/framework-4.0.4/.
When I open it to browswer and click public it just redirected to 404.
enter image description here
You should setup a virtual host in your xampp for your project.
To do that for this codeigniter projects, open the the Apache httpd-vhosts.conf file which are located in C:\xampp\apache\conf\extra\httpd-vhosts.conf, Added below lines of code at the end of the file.
using the example codeigniter-blog.local
DocumentRoot "C:/xampp/htdocs/framework-4.0.4/public"
ServerName codeigniter-blog.local
Now, Open the hosts file which are located at C:\Windows\System32\drivers\etc\hosts, Added below code into this file at the end.
127.0.0.1 codeigniter-blog.local
restart the xampp server.
If you open the browser and navigate http://codeigniter-blog.local, if you are getting welcome page, that means everything fine otherwise you'll get intl package is not enabled.

Moodle 3.5 with Reverse proxy

I'm having troubles setting up a moodle instance behind an apache proxy.
Here's my apache front-end that proxies to the running server.
<VirtualHost *:80>
ServerName public.domain.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://10.10.10.10:81/moodle/
ProxyPassReverse / http://10.10.10.10:81/moodle/
</VirtualHost>
AND.
$CFG->wwwroot = 'http://public.domain.com';
I install without problems, but when finished the installation I try in browser:
http://public.domain.com
This redirect to: http://public.domain.com/moodle/index.php?sessionstarted=1&lang=en...
Does anyone know what might be happening?
The best way to fix this issue is to move the moodle installation on the internal host to the root of web server.
Move your moodle in 10.10.10.10 to be at / and not at /moodle
Note, that if you will use SSL on the external apache (it's suggested) you should also add to your config this line:
$CFG->sslproxy = true;
Finally I have been able to fix the problem, I am writing this answer with a bigger level of detail so other people having this problem can follow my answer.
First we need to edit the apache2 config for our site:
In general the apache2 configuration for your specified site can be found at /etc/apache2/sites-enabled. Depending if you are using http or https you need to edit the right configuration file. Default name for http is 000-default.conf and for https 000-default-ssl.conf
Add the following lines between the <VirtualHost *:80>....</VirtualHost> sections.
# MOODLE
ProxyRequests Off
ProxyPreserveHost On
ProxyPass "/" "http://10.10.10.10:81/moodle/"
ProxyPassReverse "/" "http://10.10.10.10:81/moodle/"
Then we need to restart our apache2 webserver, this can be done with the command service apache2 restart.
Now we also need to edit a few things in our moodle config.php file. This file can be found at /var/www/html/moodle on the server with the IP (in this case) 10.10.10.10 if you used the default install location from the moodle guides.
In the config.php file we append the following lines under the default $CFG declarations: Please make sure to change all values according to your server setup.
$CFG->wwwroot = 'http://public.domain.com';
$CFG->dirroot = '/var/www/html/moodle';
$CFG->reverseproxy = true;
//$CFG->sslproxy = true; //UNCOMMENT this line if you are using SSL
Attention: If you are not using the root directory at your public webserver, then make sure that you do not use the same directory as moodle is using on the subserver. For example http://public.domain.com/moodle will fail if moodle is installed on the subserver at /var/html/moodle since both directories are equal and the proxy loops for some reason. My easy fix for this problem was do just move the moodle installation to /var/html/moodley including all required changes in the config.php. This fixes every problem I had.

Laravel 5.5 CRUD on Chrome

I am currently trying to run the program after I have successfully created all the necessary CRUD files. Note that I am following this tutorial here.
However, I am facing problem in trying to run the sites from my cmd. I tried taskmanager.dev but Chrome returned 'This site can’t be reached'.
May I know, is the any specific ways for me to run the site on xampp?
I am using Windows.
Please help. Thank You.
I am quite sure the guy who made the tutorial is using valet.
Just use php artisan serve and you will be able to connect to your site on localhost.
But if you really want to use taskmanager.dev do the following:
Open the hosts file, which is lotcated # C:\Windows\System32\drivers\etc\hosts
Add 127.0.0.1 taskmanager.dev at the bottom
Make sure you follow their installation tutorial closely. It sounds like you may not have configured the server correctly.
For me, I have to edit my VHosts file which is in:
C:\xampp\apache\conf\extra
And to edit my hosts file I need to go to:
C:\Windows\System32\drivers\etc
If all else fails you can always just run php artisan serve in bash to launch your app.
But I would recommend going through these instructions again:
XAMPP Virtual Host
We need to configure XAMPP Virtual Host to set the document root to correct directory of laravel project and to also assign a name to the project by which we will be accessing it in browser.
Navigate and open file /Applications/XAMPP/etc/httpd.conf file and uncomment the line that includes the virtual host file.
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Navigate and open file /Applications/XAMPP/etc/extra/httpd-vhosts.conf and include following Virtual host entry in this file.
# VirtualHost for TASKMANAGER.DEV
<VirtualHost taskmanager.dev:80>
DocumentRoot "C:\xampp\htdocs\taskmanager\public"
ServerAdmin taskmanager.dev
<Directory "C:\xampp\htdocs\taskmanager">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
With this entry our apache is listening to taskmanager.dev, but we also have to edit our hosts file to include an entry for the new domain.
Edit file /etc/hosts and add following entry to that file.
127.0.0.1 taskmanager.dev
Restart your apache and access taskmanager.dev on your browser you should be able to see this screen.
Chrome 63 now enforces .dev domains via HTTPS. Follow this article : https://laravel-news.com/chrome-63-now-forces-dev-domains-https to know more.
I've changed to .test for my valet domains. Hope this helps. Thank you.

Cannot get site loaded with Apache on Mac

I'm running El Capitan and trying to get my website hosted locally for development with Apache (that came with the OS). I followed the instructions here exactly. I made an anthony.conf file and put the Directory text in there, I replaced the actual directory with /Users/anthony/dev/web/unfinished-asteroids/ and then placed my web files in there. I started apache and navigated for localhost/~anthony but I get the
Not Found: The requested URL /~anthony was not found on this server.
standard 404 error. When I navigate to localhost it works fine and I get the "It works" from the index.html that is located in /Library/WebServer/Documents, I even changed that index.html file and it works fine.
Any ideas why I'm not able to see my website using apache? All I did was download this github repository and place it in my unfinished-asteroids folder, the index.html is at the root.
So it looks like there are a couple of extra steps that you need to do. There isn't really anything too special about apache that comes with OSX, so your standard apache configurations will work. but to get Userdir (~username) working on El Capitan,this is what I had to do
Edit /etc/apache2/httpd.conf
on (or near) line 166, uncomment
loadModule userdir_module libexec/apache2/mod_userdir.so
then on line 493 uncomment
Include /private/etc/apache2/extra/httpd-userdir.conf
then edit file /etc/apache2/extra/httpd-userdir.conf
uncomment line 16
Include /private/etc/apache2/users/*.conf
then in /etc/apache2/users/anthony.conf
<Directory "/Users/anthony/Sites/">
Options Indexes MultiViews
Require all granted
</Directory>
then sudo apachectl restart
That should make http://localhost/~anthony point to your sites directory.
Logs are stored in /var/log/apache2
Now if all you want is web access to say your dev directory you can do something like this.. (don't make any of the changes listed above)
in /etc/apache2/other/ create a file called mydev.conf (name doesn't really matter, save it needs to end in .conf')
and put this in that file
Alias /dev /Users/anthony/dev/
<Directory "/Users/anthony/dev">
Options Indexes MultiViews
Require all granted
</Directory>
and reload apache (sudo apachectl restart)
then you will be able to access your dev folder at http://localhost/dev and should be able to access your page at http://localhost/dev/web/unfinished-asteroids/
you can adjust the paths at will above, just need to make sure that the user or group _www has access to it, and that paths in the alias and the directory match.

PHP on Apache 2.2.x how to use?

I am using Windows XP SP3. I have installed Apache 2.2.9 followed by PHP 5.3 VC6.
I am able to view any plain html on localhost but i can't do so for php files.
Please help
You need to configure Apache to use PHP for .php files:
# load module and add handler
LoadModule php5_module "c:/php/php5apache2.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
Assuming the Install has been completed correctly, is your file actually stored as a PHP file? Check the properties of the file.
Try making a php file containing the following code exactly:
When opening in the browser make sure to include the .php at the end:
http://localhost/test.php

Resources