Laravel 5 on Virtual machine on Windows - php

I'm setting up an existing Laravel app onto a Windows machine for testing. The windows machine has a virtual machine setup and is running Linux.
I've edited the Windows hosts file to include the IP address and if I go to http://app.dev I can see the Laravel app as expected. however, as soon as I try to go to http://app.dev/page I get a 404 error.
The routing is set up correctly and this works fine on my typical dev machine, which is a Mac. Is there an additional setting I need to apply to make paths beyond the root path for the domain work?

If using Apache, make sure you have mod_rewrite enabled and either AllowOveride on (to use the htaccess file) or make the entries in the Apache Virtualhost to handle the rewrites.

Related

Install Matomo on Digitalocean droplet under subdomain

I already got a domain example.com and a subdomain configured under analytics.example.com.
I have ghost CMS running under example.com and want to install Matomo on the same Digitalocean host under analytics.example.com.
I already configured a second site on nginx. Permissions on the corresponding files in /var/www/matomo are set correctly, however, the index.php is downloaded instead of being executed. Any clue what is happening?
I am inclined to say that php is not working correctly. However, ghost comes with php, so it must be working?!

Working Laravel in CPanel but not in localhost without Artisan

I've installed in my remote server, via Softaculous, Laravel 8.
In order to access directly to the APP, just like when running php artisan serve in my local machine, in CPanel i defined the document root to the folder Laravel\public.
Everything works exactly as it should! I type the address (ex: myDomain.com) and the App runs perfectly...
However i don't want to being always typing php artisan serve while developing, so i tried to replicate the cpanel struture in my local machine.
To achive thar, i've created a virtualhost in XAMPP httpd-vhosts.conf pointing to the folder Laravel\public, and created the host file in windows system, like always.
When accessing the location in my local machine the first page renders perfectly, but as soon as i make a request for a new view, by example:
Route::get('/posts', function () {
return view('posts.index');
});
I get a "Not Found The requested URL was not found on this server" error! I'm sure is not a coding error because the same code runs flawlessly in remote server.
Which technique is used by cpanel to allow laravel to work directly from \public folder without necessity to initiate anything and how to replicate that in local development machine?
Well...
After much reading, backs and forwards, i believe this behavior depends on the way Apache its served by XAMPP.
So, the solution i adopted was change my local development tool to LARAGON.
Everything worked just fine with a lot of new features that donĀ“t exist in XAMPP.

How to unbind the php built-in server from a directory?

I created a local WordPress site and in XAMPP set it up with Virtual Hosts so the address test-wp.dev was the home adress. All was working fine and then for some reason I decided to turn off apache, leave mysql on and try the build in server.
So I navigated to C:/xampp/htdocs/test/wordpress/ and ran php -S localhost:8080
It worked fine. However, today I went to go back to test-wp.dev using the Apache server and it keeps redirecting to localhost:8080. I don't want to use the built in server now. I want Apache.
Where do I "unbind this" or free up that port or whatever. I don't want to have to run the built in server for that folder anymore.
Thanks.
Windows 7
PHP 5.6

How to work on server without the site being actually online?

I have a wordpress site, I need to work on it on my server but i don't want the site to be online in any way shape or form. i want to complete the site completely and only then launch it, how can i do this?
thanks,
edit: im currently using xampp, but facing issues, so i want to shift to my server.
Take the wordpress files out of the documentroot (where your files are displayed from)and put them in some temporary document and set up virtualhosts on your server so that you can have more than one documentroot so you can test it in your browser but it wont be live.
You could use something like MAMP or WAMP, MAMP works on both windows and macs, these are local server environments which you install on your own computer. You can then develop them on your computer and once finished, upload the files to the production server. This is quite common practice.
If however, you want to use your server you could block all connections which do not come from your own IP Address. For example in your .htaccess file you could put:
order deny, allow
deny from all
allow from 111.222.333.444
If it was me working on development of a WordPress site I would do it one of 2 ways:
1) Either create a new VirtualHost and password protect it
2) Use a local instance of Apache to serve the WordPress installation locally.
Option 2 is probably the handiest. Pushing the new site live is then a simple case as uploading the theme directory to the live environment and enabling it, provided you keep all relevant files within the theme directory.
Apache can be installed using either LAMP (for Linux) or WAMP (for Windows)

Development environment for a LAMP-based website - Redirects to Server Default Page

In our current environment, if any changes need to be made to the code, these changes are directly coded and updated to the Live server. GWe would like to set-up a development server where we can test our changes before uploading to the live site.
I have attempted to build a development site locally by installing Apache, PHP & MySQL and copying all the htdocs to the Apache folder. However, when I try to access localhost/ it redirects me to the server default page. Any ideas on why this may be happening?
Have you setup Apache VirtualHost and configured it for your sites Document Root?
I would look into your production site and see what's configured.
Also note that when you're setting up a dev/prod environment you will need not just PHP/Apache/etc.. install but also any packages/mods/libs that they are using installed as well.
For Example: if you're using Mod-Re-Write with Apache you need to install and enable it

Categories