How to expose yii2 basic or advanced project to localhost:80 on gcloud vm LAMP instance with numerical external address? Right now LAMP is running /var/www/shared and can pickup {exteralip}/phpmyadmin/ page.
Yii2 start serve start on localhost:8080
I can see ::1:8080 LISTEN with sudo netstat -ntlp
And i opened firewall 0.0.0.0/0 tcp:8080 to test it, but {externalip}:8080/ returns connection refused
How i could test yii2 and have it in gcloud?
Related
Hello I'm newbie for symfony frame work.
currently using Symfony version 3.4.
I'm implementing websockets to my project using Gos Web Socket Bundle (https://github.com/GeniusesOfSymfony/WebSocketBundle) and documentation also.
after run this command
`php bin/console gos:websocket:server`
getting message like this.
`Failed to listen on "tcp://127.0.0.1:8080": An attempt was made to access a socket in a way forbidden by its access
permissions.`
in config.yml added this
`# Web Socket Configuration
gos_web_socket:
server:
port: 8080 #The port the socket server will listen on
host: 127.0.0.1 #The host ip to bind to`
If I changed port no 8080 to 80 I will get any error from command prompt but in browser it doesn't work. If I used 8080 websocket server is not running. Help me out! spent whole full day on this.
Without being a root (or via sudo) you are not allowed to listen to privileged ports (<1024).
As for the port 8080 check if there is another service already running on it:
lsof -i :8080
Have you tried selecting another port, for example, 8888?
Hope this helps...
On this link:
how can i access my laravel app from another pc?
It is perfectly described how to access an laravel app from another pc on the same network.
Now, my question is:
How to access another app served on the same pc?
I have a virtual machine serving two apps app.dev and demo.dev
both are accessible inside VM through internet browser
app.dev is accessible on http://localhost and http://app.dev
demo.dev is accessible only on http://demo.dev
Outside VM only app.dev is accessible on IP address 192.168.0.60
i have used this command inside VM
sudo php artisan serve --host 192.168.0.60 --port 80
Should i use again
sudo php artisan serve ????
but how? anybody help?
Laravel's artisan serve command uses the PHP Built-in web server. Because that is not a full featured web server, it has no concept of virtual hosts, so it can only run one instance of the server mapped to an IP and port pair.
Normally to serve two hosts from the same IP address you'd add in your VM's /etc/hosts file the following mappings:
192.168.0.60 app.dev
192.168.0.60 demo.dev
Now you can run app.dev by running:
php artisan serve --host app.dev --port 80
And it will be available on your host machine using http://app.dev. However if you would try to spin up a second server instance for demo.dev using this:
php artisan serve --host demo.dev --port 80
It won't work and will complain that:
Address already in use
You could get around that by using a different port for your demo.dev app by using for example this:
php artisan serve --host demo.dev --port 8080
And now you'd be able to access http://demo.dev:8080 for your second app on your host machine.
That being said, I suggest you install a full featured web server such as Apache or nginx and then setup a virtual host for each application (just make sure to keep the mappings from the /etc/hosts file I showcased above).
Setting up virtual hosts can be really easy for both server solutions. Below are links to two articles from the Laravel Recipes website that showcase how to do that specifically for Laravel:
Creating an Apache VirtualHost
Creating a Nginx VirtualHost
I have a Linux virtual box, built using Vagrant. I am working on an application built using Symfony2 and wish to use PHP's built in server to host the application. I have got the PHP server running successfully using the command: php bin/console server:start. This tells me:
[OK] Web server listening on http://127.0.0.1:8000
I've specified the following in the Vagrantfile:
config.vm.network "private_network", ip: "192.168.56.109
I want to access the application via the browser on my host machine which is running on Windows 7.
How can I achieve this?
The default IP for the built-in web server is 127.0.0.1. In order for it to be visible outside your vagrant machine, you need to bind it to 0.0.0.0:
php bin/console server:start 0.0.0.0
Then you access http://192.168.56.109:8000 and it should work correctly.
I have setup my wercker.yml file with the following step midway:
- script:
name: Serve application
code: php -S localhost:8000 >> /dev/null &
That appears to run, however, in another step when I try cURL to http://localhost:8000 I get the following:
curl: (7) Failed to connect to localhost port 8000: Connection refused
It does it for all ports, not just 8000. Has anyone else managed to get PHP's in built server working in wercker, or open any ports?
Assuming you're using the wercker CLI and trying to set up a development pipeline, you need to use wercker dev with the --publish 8000 argument. This will forward the traffic from your host on port 8000 to the container on port 8000.
Also, if you're using boot2docker, you can't specify localhost, since boot2docker spins up a VM that runs docker. In that case you'll need to use your boot2docker IP, which you can find by running the boot2docker ip command.
i am new to laravel and basically i am a nodejs developer, i basically develop application in sailsjs and i access my sailjs application on another machine within same network by using my machine ip on which the project is running.
like i lift main salsjs application on A machine using sails lift --port 1334 and then goto another machine B within same network and access is with my A machine ip , like 192.168.10.2:1334
now i want to do the same thing with laravel, i've lifted my server using laravel command
ahsan#ahsan-Inspiron-N5110:~/Desktop/Development/laravell/laravel$ sudo php artisan serve --port 1334
Laravel development server started on http://localhost:1334
and now the application is running on 1334 port and when i try to access it from machine B within same network it just says unble to connect.
Please let me knowo what do i need to do to access it over network with my machine A ip address.
Thanks.
Note: i am using UBUNTU on Machine A and have access to sailsjs application on Machine B which is windows based but not the laravel application access
php artisan serve --host 0.0.0.0 --port 1334
or
php artisan serve --host 192.168.10.2 --port 1334
in most cases you will need permissions (sudo) to start this. If its not working, check your firewall (iptables)