Running polymer serve to serve publically in a virtual machine (VM) - vagrant

Using the Polymer CLI, can polymer serve be used to run the web server publicly so the computer hosting the VM can see the site? i.e. hosting it like a normal webserver?
To place this in context, I'd like to use Polymer CLI in a Vagrant created VM and run polymer serve in the virtual machine to see the results and isolate the environment.

I started trying polymer this morning and ran across the same problem/question as i didnt want to try on my host machine.
Here is what i did:
sudo a2enmod proxy_http
sudo nano /etc/apache2/sites-available/000-default.conf
added to vhost-entry:
ProxyPass /polymer/ http://localhost:8080/
ProxyPassReverse /polymer/ http://localhost:8080/
sudo service apache2 restart
Please dont kill me guys, if its stupid, but it seems to work so far.

Related

How can I setup my nextjs app to run on EC2 as it's only running on localhost?

I would like to make my nextjs app run on an EC2 instance (ubuntu 18.04).
However, when I sudo npm start, it's then running on localhost, and I don't know how to make it accessible from outside. I tried to access the IP given by AWS and to add the port (:3000), without success.
Would you have an idea of how I must setup this app to be accessible ? What did I miss ?
Finally found out
Localhost is not the problem, it was that the ports are not open by default on EC2 instances.
By adding a Security Group and opening the ports I needed (http for 80, https 443, ssh with 22, and 3000 for the test) it worked out.

Not found error on setting up local server using LAMPP

When I enter localhost/hello.php in my browser, I get below error.
Not Found
The requested URL /hello.php was not found on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80
I think there is some compatibility issue in the LAMPP and Ubuntu.
To start apache2 normally you need to first hard stop it through following command:
Sudo service apache2 stop.
And then restart the apache2 or LAMPP . This worked for me.

Mac docker unable to access port 80 with nginx

I'm following the tutorial "Getting started with Docker for Mac" but I'm unable to access the nginx home page at localhost. Every time I access localhost, the displayed page is "It works!" which is the default page contained in /Library/WebServer/Documents/index.html.en. I tried to kill all httpd services to remove the binding to the port 80 but it didn't change anything. I also checked that there wasn't any application that was running on port 80 and that neither Skype, MAMP or an Apache server who could be using this port was running.
I think that my Docker installation is correct as I'm able to run the docker --version, docker-machine --version and docker-compose --version without error. I'm running the container with the command described in the tutorial
docker run -d -p 80:80 --name webserver nginx but it doesn't work. I tried many ports but it didn't change anything.
Here is the output of a
docker ps
So I tried to access the app via 0.0.0.0:80 but it didn't work neither, it always redirect me to the page contained in Library/WebServer/Documents/index.html.en. I tried binding to all kind of ports (8080:80, 8181:81, 8181:80, 8181:8181 ...) and nothing never changed. In those case, I got a page telling me
"Safari can't connect to server. Safari can't open the page "0.0.0.0:8080" because Safari can't connect to server "0.0.0.0".
I also tried replacing localhost by 127.0.0.1 but I still have the issue.
If you need further explanations or have any question, ask me. Thanks in advance for your help

Can't expose web server using docker on OSX

I have a docker image that runs a webserver and I would like to access it from my local OSX, but I'm having issues.
I start the container with: docker run -p 8000:8000 <container-name>
and I can see log messages telling me that the local server is listening on localhost:8000
I am able to get a successful response from running:
docker exec <IMAGE-ID> curl "http://localhost:8000/"
Addresses I've tried on my local OSX are:
http://localhost:8000/
http://<DOCKER-IP-172.17.0.2:8000/
Neither of those work. Any suggestions?
Container is built from golang:1.8
Docker Version: Version 17.03.1-ce-mac5 (16048)
MacOS Sierra: 10.12.4
Firewall is turned off for testing purposes
I've tried the same process on Ubuntu 16.04 and no luck their either.
The newer versions of docker use vpnkit on OSX to manage the port forwarding to the containers... you should allow vpnkit through your firewall if you want to expose the container ports.
Also, in your Go code, make sure to bind to 0.0.0.0 rather than 127.0.0.1 for your webserver code.

How to set up Virtual Hosting on a Mac (local)

How can I setup a virtual hosting on my Mac. It should be easy by adding a 127.0.0.1 line to the hosts file and editing the apache configuration. But for some reason, it doesn't work with me...
And no, MAMP is not an option since you can't setup vhosts in MAMP (except if you buy the MAMP Pro...)
Any advice?
It works just fine, i have several vhosts set up on my OS X box under apache. Make sure that you are using name-based virtual hosting AND that if you are using apache that is distributed with OS X and the vhosts config is in a separate file (e.g. in /etc/apache2/other/httpd-vhosts.conf) that it is actually getting included. Also you can always test apachectl -t -D DUMP_VHOSTS to see if the virtual hosts are actually getting defined.

Resources