i just use yum install tomcat7 to setup the tomcat7 and change the port, in the /usr/share/tomcat/conf/server.xml from 8080 to 80 and service tomcat6 start, it works fine.
but when i do the netstat -nlp, there is no 80 port, and also other cannot visit the 80 port
try to create ROOT, i think you did not create it yet, that way make your website unavaialbel.
When you do netstat it typically will show you http, not 80: this is because 80 is bound to http in /etc/services. You'll see something like this:
tcp 0 0 *:http *:* LISTEN
Assuming you're not experiencing a Tomcat error, make sure that you've set up the EC2 security group to allow access to port 80. Look at this for a decent treatment.
EDIT: if 8080 works but 80 doesn't then it is either:
Some other program (such as Apache) sitting on port 80.
You're probably not running with the right privileges. On most Linux distributions you need to be the root user (or running as a system process) to access ports numbered less than 1023
Related
I followed the tutorial Create Linux Virtual Machine and everything seems correct, what do I know since this is my first attempt. I can't see whats wrong, I can ssh to it and run things, etc.
The issue I have is that I can't ping the public ip address. The prompt just hangs. At the end of the tutorial it asks to view a website on the page, and the browser just times out?
Is there something I should look at?
The tutorial creates a website with nginx and I have never used this, but it expects port 80 to be open. I added port 80 open for the Network Security Group.
I eventually will use Tomcat at port 8080 so I installed and opened port 8080 in the Network security group.
If I try to connect over port 80: ipAddress:80 ERR_CONNECTION_TIMED_OUT
if I ssh to the vm and use ps aux | grep nginx i get a response like
root 7809 0.0 0.0 116528 1400 ? Ss 20:56 0:00
nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 7810 0.0 0.0 116880 2576 ? S 20:56 0:00 nginx: worker process
The server is running.
if I try ipAddress:8080 I get the tomcat default web page. I can't figure out why nginx doesn't work.
ping wont work. you need to open up website port on the NSG and on your linux box. you can use this guide: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal
ping is disabled in Azure for public facing IPs
regarding the ports you need to consider two things, first as you mention the NSG has to enable the traffic for the ports of interest, its important to consider that you can have NSGs at the NIC and Vnet levels, please review which one do you have, secondly once the NSG has been opened there has to be a listening service on the VM, you mention that the tutorial tells you to use port 80 but then looks like tomcat uses 8080 instead, I recommend running the following command to verify the listening ports at the OS level
sudo netstat -plnt
please let me know if this helps
I have an Ubuntu16.04 VM on Azure, and am trying to run a node server on it. When I bind the port to 80, I am able to access it from my browser (http://a.b.c.d:80). However, if I try to instead bind the server to a different port, such as 3300 or 8080, the browser times out when trying to connect to it. (http://a.b.c.d:3300)
I have ensured that:
There exists an inbound security rule for port 3300 in the NSG
The windows firewall of the machine of the browser allows port 3300 (I have even tried temporarily turning it completely off but to no avail)
I am not using an azure load balancer
I am starting node with root privileges
Node is bound to (port, "0.0.0.0")
I am listening on the correct port (I think?)
netstat -ant | grep 3300 gives
tcp6 0 0 :::3300 :::* LISTEN
I have spent a few hours now researching on the internet how to get it to work and tried everything I could find, but to no avail. If anyone has any input i'd be happy to try it out.
Jason was correct, it was a ufw issue. If anyone comes across this question in the future, I solved it with the command
sudo ufw allow proto tcp from any to any port 3300
I want to setup my dev environment so that all requests from www.dev.com in my browser are routed to localhost:8080.
I added 127.0.01 www.dev.com in my /etc/host, but it doesn't do the port forwarding. If I go to http://www.dev.com:8080/ it works, but I want/need to use http://www.dev.com/ instead, which is closer to the actual production environment.
How do I do that? I tried several solutions like nginx, but I don't like it, I'd prefer it to be "scriptable", so that any other developer can use it directly. I'm using Express.js with Node.
I read through Assigning a domain name to localhost for development environment on Mac OS X with node.js but it actually doesn't explain the port-forwarding part.
You can use Mac port forwarding. Binding to port 80 requires root privileges (anything below 1024(?) needs root) and it's probably best not to run a development application with root.
You can use pfctl port forwarding
e.g. To forward port 80 to 8080
echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -
source: https://salferrarello.com/mac-pfctl-port-forwarding/
You can also use ipfw (Not available on El Capitan)
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in
In open source project,project open, I'm trying to run the server on port 80 for http and 443 for https which gave an error
[-nssock:driver-] Error: nssock: failed to listen on 0.0.0.0:80: Permission denied
and also is there anything else required to enable https port(like certification,etc)
Are there any other applications which already used the port 80? run below command to find out what applicaiton use the resource
netstat -an |grep "\.80 "
lsof -i:80
Probably you are trying to run AolServer as non-root user, but AolServer is configured to use "privileged" ports 80 and 443 (ports below 1024 are "privileged").
You may either configure your system to allow non-root process to bind to "privileged" ports, or just run AolServer as root. For the first approach also check discussion of the capabilities system.
I'm a Linux beginner and have a Linux Ubuntu 12.04 server. I've installed node.js and created a webserver script. That works fine, but it runs as root user.
I know that's not good (root-user & webserver = unsafe).
How can I run the webserver script as an non-root user? Does somebody know a good detailed tutorial or can give me some advice?
You have two options:
Listen on port 80
Run as root, start your app's listen() on port 80 and them immediately drop to non-root. This is what Apache does, for example. Not recommended since it's easy to get this wrong, and lots of other details (writing to log files, initialization required before you can listen, etc.). Not standard practice in node.
Listen on port >=1024*
Run as non-root, listen on a port >= 1024 (say: 8000, or 8080), and have someone else listen on port 80 and relay port 80 traffic to you. That someone else can be:
A load-balancer, NAT, proxy, etc. (Maybe an EC2 load balancer if you're running on EC2, e.g.)
Another http server, say Apache httpd or ngnix.
For an ngnix example, see this: Node.js + Nginx - What now?
you can just run node hello.js