Laravel serve getting ERR_CONNECTION_REFUSED on localhost - apache

I'm having an issue with my local laravel server. I'm building an API, and I need to test from another device, but the only url which is working is:
localhost:8000
If I try
127.0.0.1:8000
or using my machine local IP
192.168.0.6:8000
I have a ERR_CONNECTION_REFUSED from chrome (I tried with safari too).
There is no 'blocking' extensions

I found the answer: artisan serve isolates the host, so if I want to specify it, I need to do:
php artisan serve --host=127.0.0.1

Depending on what project you may in! In our case we had a bought project!
And https is configured by default! So https://..../app.css will not be accessible!
When you visit the link again in chrome it switch to http://.../app.css and it will work!
For our bought base code an env variable was setup and i just disabled it as bellow:
You may like to disable it in development!
This link may be helpful too!
How to force Laravel Project to use HTTPS for all routes?
Otherwise you can setup https to work well! Check how to do that with apache! Or nginx !
Otherwise know that you can't do it with php artisan serve! And you'll need to disable force https!
See the option bellow! (check the first answer to see if you can still use php artisan serve! And read the second one! To get why php artisan serve doesn't support https)
Laravel php artisan serve to mimic HTTPS
I hope this may help some! That fall on the same problem! Which is a line of things to check to add to the list here!

php artisan serve :
Laravel development server started on http://localhost:8000/
so you can only access to this server by http://localhost:8000/

I had that problem because I forgot to execute npm run devto launch Vite server.

Open up the terminal window in your working directory and run
php artisan serve
You will then be able to access your laravel local development through your browser by using the URL http://localhost:8000

Related

Mod wsgi and apache configuration

I'm facing the following issue: i've a public web server running on a given URL, say, www.mysite.com.
It uses apache2.
I've developed a python web app and I want to make it publicly accessible.
Locally, I use the command
mod_wsgi-express start-server wsgi.py
to start the server and everything works.
However, I would like to link only a specific URL to my app, such as mysite/my_test, leaving apache2 serving all the other requests.
In other words, I would like to set the server URL for mod_wsgi-express to mysite/my_test port 80.
By default I get Server URL: http://localhost:8000, and I would like to change this.
I've tried the --mount-point option, but I didn't see any difference.
I know I can change the apache configuration and adding WSGIScriptAlias but I'm facing multiple issues, so I'm searching for a quickest and easiest way.
Hope this is clear.
Thanks.

How to communicate with a backend built with lumen and served with apache virtual host from a Vue frontend?

I have a Vue frontend through which I want to communicate with a backend built with lumen. I have the backend on apache virtual host. It is a local development setup. The virtual host works and I can access it from http://dawn.axeapi.com/ and postman works fine with it.
I've set VUE_APP_API to http://dawn.axeapi.com/ in the .env file. The Vue app is being served with npm run serve.
I am getting following errors in the console and the network tab in developer tools.
But if I double click the requests (e.g. 3304272), I can see JSON data from the backend.
If I serve the backend with php -S localhost:8000 -t public and update VUE_APP_API accordingly, everything works as it should.
Is this because of CORS?
Does apache configuration affect this?
I read in Vue documentation that API requests to the API server need to be proxied during development if the frontend and the backend API server are not running on the same host. So I tried adding
devServer: {
proxy: 'http://dawn.axeapi.com/'
}
to vue.config.js but didn't work.
I am running Apache that ships with macOS.
What am I missing here?
For anyone running Apache that ships with macOS, disable these Apache modules and it should work. I had to disable all eight. You can try one at a time.
mod_authn_file.so
mod_authn_core.so
mod_authz_host.so
mod_authz_groupfile.so
mod_authz_user.so
mod_access_compat.so
mod_auth_basic.so
mod_reqtimeout.so

Howto run mod-mono and php on same apache webserver

I've successfully implemented mod-mono and apache webserver on a Centos 8 distro.
I've also installed PHP 7.2 on the server and the configuration looks ok on eye inspection.
However, the webserver is not executing the PHP files, but serving them for download.
If i go to http://example.com - it runs the website in MONO space
If I go to http://example.com/info.php - it gives me the PHP file for downloading. It makes me think that it tries to run the php file through mono and fails, so gives it to me for download instead forwarding it to PHP for execution.
Is it possible to run both PHP and MONO code on same apache webserver?
If yes, what could be the tricks to have it working ?
Many thanks.
Actually having a separate PHP website and also MONO websites in same apache server was working. However I though things were not working since I tried to run the PHP file from within the MONO-handled virtualhost ... so no need for clarifications.

How do you install an apache server (httpd) on codenvy?

I would like to have a simple httpd server on my codenvy machine in order to run a front-end web app. How do I install it?
Create a workspace with the template "php-default", then a php project. Try run, access the url the "start apache" gave you, and it should work ! I got a running app in less than 3 minutes.

Laravel - connect to development server

I just installed laravel and need some clues regarding "development server" and how I can run a project.
I connected to laravel development center which opened port 8000 on localhost. So I access my project at
localhost:8000
It wouldn't work if I typed in localhost/thelaravelproject/somepage , as I do with other php projects during development.
After closing the command line tool, localhost:8000 became inactive, so I opened the command line again, entered the path, and then
php artisan serve
and then it was running again. Does this mean that I have to do this every time?
On this page laravel.com/docs/4.2/quick it says something about "Local Development Environment" and it mentions Laravel Homestead. Is this something that is needed to run laravel using localhost the way I normally work with php?
I follow tutorials, but it's strange how they leave out very important details.
I found out that localhost works the normal way, I just have to add the 'public' directory.
So if I type in
localhost/thelaravelproject/public
it shows the 'you have arrived' page.
In laravel project Directory every things first goes to the public/index.php.
so it have to be in that directory.
you have to start from this
localhost/thelaravelproject/public.
following link will help you.