Hello I am following this tutorial from the AngularJS documentation.
I am trying to use this approach for learning this.
You will need an http server running on your system. Mac and Linux machines typically have Apache pre-installed, but If you don't already have one installed, you can use node to run scripts/web-server.js, a simple bundled http server.
My server is started but the only things that happens on localhost:8000 (the port its running on) is that files get listed.
How do I deploy with Node.js?
When I navigate to localhost:8000 in my browser, this is my server log.
112-108-15:scripts phe$ ./web-server.js
Http Server running at http://localhost:8000/
GET / Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
GET / Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
As you can see the instruction, you need to run
node ./scripts/web-server.js
and go to http://localhost:8000/app/index.html.
If you have node installed, go to the directory where your angular application is and type:
scripts/webserver.js
hit enter and voila!
You can visit your site at:
http://localhost:8000/
If you don't have node installed, install node and then go to the first step.
You need to serve the files from a server on your local machine.
In the docs, it is mentioned you can serve the files from a node server.
However, if you do not want to download and run nodejs, and you are on Mac/Linux you have python already installed, you can also cd into the directory with index.html and run a python server - python -m SimpleHTTPServer 8000. This will serve the files on port 8000. Go to localhost:8000 and you will see your files being rendered.
And, if you want to deploy it to production on a remote machine, I came across deployment of nodejs & angular application deployment to production using ansible. I used the same to deploy my first app to production.
Related
I am building a web application using Scotty and have installed GHC and Cabal using GHCup inside of WSL2 (Windows Subsystem for Linux 2). The application worked when I ran it natively on Windows. I am running the application on port 3000 and I am certain that the port is free. When I try to access the application through a browser from Windows, I receive an ERR_EMPTY_RESPONSE error. I have tried using both localhost:3000 and 127.0.1.1:3000, which is the output of wsl hostname -i, but I still get the same error. Even when I try to curl the application from inside WSL2, I get the same output. However, when I spin up an nginx server inside WSL2, it works as expected and I can access it from both WSL2 and Windows.
The interesting thing is that Scotty can see the requests and even thinks that it is successfully replying to them (as indicated by the 200 response codes):
Setting phasers to stun... (port 3000) (ctrl-c to quit)
GET /
Accept: */*
Status: 200 OK 0.000570011s
GET /
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Status: 200 OK 0.000548668s
GET /
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Status: 200 OK 0.000659229s
An old web app that uses Angular, gulp and coffee-script, and was running whit forever(NPM package).
When I click the sign-in button on the page, the page will refresh and show a 404 error, an apache access log saying
"POST /api/user/sign-in HTTP/1.1" 404 488 "http://localhost/sign-in" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
Need help, thanks
We didn't change any code or env, only use Nginx Proxy manager to take the place of Kemp load balancer.
I got the apache log because I copied all stuff and the database running it on localhost.
I have installed browsersync using command npm install -g browser-sync in windows 10 x64. nodejs version 10.11.0 browsersync version 2.26.3
everything is working fine in desktop. but when i try to access http://192.168.56.1:3000 from mobile device using same wifi, i get "this site can't be reached"
i have installed another tool named dev-ip which returns this in powershell:
[ '192.168.56.1', '192.168.0.120' ]
the ip series 192.168.0.120 used to work fine in my mobile devices.
now, how to use the ip 192.168.0.120 instead of 192.168.56.1 in browsersync globally?
Just specify the host in your configuration that you want the server to run on.
Eg. In you case it would be
host: "192.168.0.120"
You can refer to the link below for more information.
https://www.browsersync.io/docs/options#option-host
Hi, guys. This is how it worked for me:
Source:
windows 10
all firewalls are closed
network access (from windows) to the PC is disabled
external url from gulp 192.168.56.1:3000
proxying local php site from OpenServer
external device - iphone safari/chrome
external (virtual) device - vwware with macos
make sure that Windows Defender firewall monitor in high-risk mode -> rules for incoming connections -> Node.js: Server-side JavaScript is enabled (and other necessary apps)
Solution:
look at what ip address in the home network my PC has (all devices are connected to the same network) - for example 192.168.1.103
in the gulp file I specify it host: "192.168.1.103",
save
checking it out
Important:
for source - external device - iphone safari/chrome - correct url is only 192.168.1.103:3000
for source - external (virtual) device - vwware with macos - correct urls is 192.168.1.103:3000 and 192.168.56.1:3000 both
Visually in pic:
Result:
Checked on all devices, in virtual devices, on the PC itself
browsersync works
the Internet is not lost
there is no address conflict within the network
Hope this will help someone too 🙂
You don't have to change the settings.
run cmd using Administrator
run ipconfig
copy IPv4 address like 192.168.43.52
Now open google on mobile and add http:// at the front and :3000 or :5500 at the back.
like run http://192.168.43.52:3000
I can't open the zabbix frontend URL via
http://zabbixservername/zabbix
Error 404 is given:
Not Found
The requested URL /zabbix was not found on this server.
Apache/2.4.7 (Ubuntu) Server at ipaddress Port 80
I'm running Ubuntu 14.04 LTS (GNU/Linux 3.13.0-27-generic x86_64)
I installed Zabbix server following Zabbix instructions for Ubuntu 14.04 at:
https://www.zabbix.com/documentation/2.2/manual/installation/install_from_packages
(bottom section of the page)
Though the follwowing file was not created:
/etc/apache2/conf.d/zabbix.conf
But I did edit regional settings in:
/etc/zabbix/apache.conf
After that I also copied the apache.conf to /etc/apache2/conf.d/zabbix.conf
restarted apache, but gave no result
Apache is running; when I go to http://zabbixservername/, I get the Apache default welcome page.
Also zabbix-server process is running on the server.
This is what the Apache acces.log says when I try to enter the frontend http://zabbixservername/zabbix
[04/Jun/2014:14:42:54 +0200] "GET /zabbix HTTP/1.1" 404 494 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
I would guess the problem lies somewhere within the communication between Apache and Zabbix?
If so... I don't know how to check and/or fix that...
Looking for some guidance here.
Additional information can be provided.
Though xunil's answer is right, let me correct it a little bit corresponding to the Ubuntu 14.04 and it's Apache 2.4
ln -s /etc/zabbix/apache.conf /etc/apache2/conf-available/zabbix.conf
It will put a symlink to the Apache config folder...
a2enconf zabbix.conf
service apache2 reload
...and these will reload the server to pick up the new configurations.
sudo cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf-available/zabbix.conf
sudo a2enconf zabbix.conf
sudo service apache2 reload
I can curl the contents of an internally hosted site using curl http://localhost:9000 but cannot connect when I try to open the same in the windows browser http://ip-address:9000/. I am trying to do this from within the internal network.
The admin needed to open up iptables port 3000 and then it worked on the browser.
Getting the site via curl using localhost as the address implies that your machine (the local host) is the one hosting the site. Then you say that you're on Windows and the site's being served by a linux machine. Which is it?
Regardless, if you can get the contents via curl using http://localhost:9000, then you should be able to get the contents via your web browser using http://localhost:9000. Try that.