Laravel 5.5 CRUD on Chrome - laravel

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.

Related

Laragon auto Vartual host file gets reset on refresh

hi I have many sites that I want to test on local, so when I edit the files on auto virtual host files under Apache->sites-enabled->file name, after reloading laragon, the file resets to its original default contents, ex-
Original
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/cast.see.tech/public"
ServerName cast.see.tech.test
ServerAlias *.cast.see.tech.test
<Directory "C:/laragon/www/cast.see.tech/public">
AllowOverride All
Require all granted
</Directory>
edited
<VirtualHost 192.168.1.101:80>
DocumentRoot "C:/laragon/www/cast.see.tech/public"
ServerName cast.see.tech.test
ServerAlias *.cast.see.tech.test
<Directory "C:/laragon/www/cast.see.tech/public">
AllowOverride All
Order Deny,Allow
Allow from all
Require all granted
</Directory>
I cannot save any rules, any code, it comes back to its default original content once I restart laragon server. I am using windows 11, but the same problem I face on windows 10 also.
I tried uninstalling and installing back, but still no luck. Currently i am using latest version of laragon 5.0.0 210523, I also tried downgrading the version but still the same problem. Is it a windows issue or do I need to do something else. Please help me with this issue.
Each project has each own Virtual Host file located in:
For Apache:
{LARAGON_ROOT}\etc\apache2\sites-enabled\auto.{project}.test.conf
For Nginx:
{LARAGON_ROOT}\etc\nginx\sites-enabled\auto.{project}.test.conf
Content of a .conf file is auto generated. If you have a specific project which has modified content, just remove the auto. prefix from config file names eg : auto.example.test.conf => example.test.conf , Laragon will keep the content of the .conf file intact.
Virtual Host content is configurable, you can change it by modifying the template in:
{LARAGON_ROOT}\usr\tpl\VirtualHost.tpl
https://laragon.org/docs/pretty-urls.html
Laragon uses a template to auto-generate the virtual hosts.
On windows, the file is located at C:\laragon\usr\tpl\VirtualHost.tpl, assuming you installed it in C:\laragon.
Just edit this file and make the changes you want.
Keep in mind that all your sites will now use the same configurations.
One change I personally make is to remove the *. from ServerAlias, as I use subdomain format for my sites. Before I remove it, subdomain.example.com would always redirect to example.com.

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.

how to configure laravel site on localhost using xampp

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.

How to set mydomain.com locally in laravel?

I am new to laravel, and I have installed a fresh copy of laravel. My project root directory is located in E:/xampp/htdocs/myapp and I want this to load on myapp.com in browser how exactly to do this ? I am using laravel 5.2 and xampp for my project.
It is possible with enabling virtual host on your xampp settings. First of all you need to visit E:\xampp\apache\conf\extra\https-vhosts.conf and make some edits. Edit httpd-vhosts.conf file in your favorite editor and add the below code at end of the httpd-vhosts.conf file.
<VirtualHost *:80>
DocumentRoot "E:/xampp/htdocs/yourprojectfolder/public"
ServerName yourdesirename.com
</VirtualHost>
After this you need open notepad as administrator and edit hosts file
(C:\Windows\System32\drivers\etc\hosts)
Note : If hosts file is not showing in the target directory you need to change the select box to 'Show All Files'
and add 127.0.0.1 localhost yourdesirename.com at the end of hosts file, once done now open your browser and type yourdesirename.com and your project will dance live there.
If you're using Laravel 5.2 Valet is a pretty nice tool.

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.

Resources