That’s all for the creation of a virtual host with laravel. Now you can start to work on your project without worrying about the local server configuration. Here Document Root is the path to the public folder of your laravel project.Īdd the same for the directory “C:\xampp\htdocs\ laravel_project \public”įor the server name add the same name that you added in the previous step in the host’s files i.e. Header add Access-Control-Allow-Credentials: “true” Here, we are defining a new virtual host with the server name we want to use, the root of our site and the settings for this directory. ![]() Header add Access-Control-Allow-Methods “POST, GET, PUT, DELETE, OPTIONS” Configure localhost first, add the following information to the configuration file httpd-vhosts. Header add Access-Control-Allow-Headers “Origin,Content-Type, Accept,Authorization,x-API- key, X- CSRF-TOKEN” Header set Access-Control-Allow-Origin “*” So the file name that you have to open is nf.ĭocumentRoot “C:\xampp\htdocs\laravel_project \public” To do that open the from the following paths \xampp\apache\conf\extra\nf. So to run the laravel project from the virtual host we will give the path to the public folder. The entry point of a laravel application is the index.php inside the public folder, so the desired directory for our application will be the absolute path to your project in the public folder. ![]() Here 127.0.0.1 is the host on which you want to run your project and “laravel_proj.test” is the name of the URL on which you will run your project as a virtual host. Now add this line on the page like this: 127.0.0.1 laravel_proj.test to enable VirtualHost with SSL at the same time here is what i did. so to have the admin rights just open this file with notepad . im Using XAMPP 3.2.1, Compiled May,7 2013. Remember to edit the host’s file using an editor with administrator rights, otherwise, you won’t be able to save the changes. You need to modify the host file of Windows located in C:\Windows\System32\drivers\etc\hosts. Visit the below link to download notepad So this is step one first you need to download notepad as its easy for you to access the files with administrator rights in note pad by following these steps you will be able to create your own virtual host Step 1 ![]() So the question is how you can create a virtual host now. The virtual host will give you the domain for your local on which you can run your project every time and that domain will be limited to your machine only and will not be public. If you have a virtual host for your projects you will not have to think about running the PHP artisan server every time you want to make changes to the project. As we all know how much important it is to have a virtual host for any of your projects.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |