Accessing .net core website hosted on Ubuntu 16.04 through internet - linux

I am following along this tutorial to deploy my asp.net application onto Ubuntu. I have installed .Net core 2.0 on my Ubuntu machine using this post. NO issues with that excellent article.
My VM configuration is :
user#instance-2:~/dev/mywebsite$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
I have confirm that .Net core is installed properly.
user#instance-2:~/dev/mywebsite$ dotnet --info
.NET Command Line Tools (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.0.0/
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
Next I have created new dot net web application using below command
dotnet new web
set ASPNETCORE_URLS environment variable
export ASPNETCORE_URLS=http://+:5123
Confirmed that its set properly.
user#instance-2:~/dev/mywebsite$ echo $ASPNETCORE_URLS
http://+:5123
Ran my application using dotnet run. Can see below message on console.
user#instance-2:~/dev/mywebsite$ dotnet run
Hosting environment: Production
Content root path: /home/hemant_shelar/dev/mywebsite
Now listening on: http://[::]:5123
Application started. Press Ctrl+C to shut down.
Expected: I should be able to browse this site from internet using IP address
like : http://35.185.21.120:5123/ But I am not able to access this site from outside. Getting ERR_CONNECTION_TIMED_OUT error.
Note: 35.185.21.120 is IP address of my Ubuntu machine which is in google cloud.
Am I missing any configuration?
UPDATE 1:
I have open port 5123 using below command
sudo ufw enable
sudo ufw allow 5123
Verified that port is opened using below command:
hemant_shelar#instance-2:~/dev/mywebsite$ sudo ufw status
Status: active
To Action From
-- ------ ----
5123 ALLOW Anywhere
5123 (v6) ALLOW Anywhere (v6)
But still same issue.
UPDATE 2
I set environment variable ASPNETCORE_URLS to http://+:80
hemant_shelar#instance-2:~/dev/mywebsite$ echo $ASPNETCORE_URLS
http://+:80
hemant_shelar#instance-2:~/dev/mywebsite$ sudo dotnet run
Hosting environment: Production
Content root path: /home/hemant_shelar/dev/mywebsite
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
But when I run website its listing on port 5000. Is there any other way to expose site on port 80? e.g. in IIS we use http host header to open multiple sites on port 80.

Related

Can't access Neo4j community version in the browser (installed on a Linux virtual machine in Azure)

I tried to install Neo4j community edition on a VM in Azure, I can't access it in the browser.
I did this:
Created a virtual machine in Azure on which you can host a Neo4j community version server
I choose Linux (Ubuntu 18.04) virtual machine in Azure
Connect to the virtual machine throught Azure CLI and start installing
Installed Java 11 throught Azure CLI
Installed the latest Neo4j community version throught Azure CLI
Setted up Neo4j to be accessible over the internet: sudo vim /etc/neo4j/neo4j.conf
Add/edit the following lines to the config file:
dbms.connector.bolt.enabled=true
dbms.connector.bolt.listen_address=0.0.0.0:7687
dbms.connector.http.enabled=true
dbms.connector.http.listen_address=0.0.0.0:7474
To access port 7474 from outside the Linux machine, I added it to the inbound port rules for the virtual machine (but I'm not sure if I did it wright)
Inbound security rules:
I tried to access to Neo4j in the browser with: http://<ip_adress_of_vm>:7474
But 8) doesn't work: ERR_CONNECTION_REFUSED.
I don't know if it is the best method to install Neo4j community version in a Linux virtual machine.
What do I have to change to succeed in opening this in the browser ? Maybe I did bad 7) ?
According to the messages you provided, the problem is that you do not add the Inbound rules for ports 7474 and 7687 to allow the traffic.

How to deploy dotnet core application on Ubuntu server with Nginx server?

I have a dotnet core application built on dotnet core 3.1 and when I tried to deploy the same in ubuntu 18.04 server by following the steps given in this doc but not able to access the app on port 80 (accessing through public IP)
Here is the Nginx updated configuration
and dotnet application is running with port 5000 and 5001 (for now I didn't configure service to the same)
Getting the following error when accessing through the browsers ( public IP)
I'm missing any configurations?
The problem was IISexpress port access issue.
By default, the IISexpress does not allow the external network to access the port and this access needs an explicit configuration.
If you are facing the same problem, you can find the code snippet and other details here.
Accessing IISExpress for an asp.net core API via IP

Angular 4 Failed to load resource: net::ERR_CONNECTION_REFUSED

I guess I will start at the start of my application.
I am making a full mean-stack application and I want it to run in docker. To use docker I am using a virtualbox with Ubuntu. When I run my docker-compose, everything is working on localhost:4200. Now I want to open my application on my host machine (Windows 7).
When I go to my application via (ip addres should be kept secret, right?) xxx.xxx.xx.xxx:4200/login the page looks fine, but I get these errors:
I am using Angular cli 1.4.1 with node 8.4.0
Why am I getting these errors and how do I fix them?
My docker-compose
Your server which is listening on port 4200 is listening on your xxx.xxx.xxx.xxx interface (not necessary to hide lan IP, but nevermind...).
Your angular application is running on your host system. the localhost is the localhost of your host system, not the guest. so you have two solutions:
changing your urls inside the angular application to point to xxx.xxx.xxx.xxx:4200 instead of localhost:4200.
Forwarding your 4200 port from your host to your guest system using virtual box :
shutdown guest.
select guest and click on settings
go to the network tab.
click on "advanced"
then select "ports redirections" and bind your host 127.0.0.1:4200 to your guest's 4200 port

Selenium grid ubuntu host can't create node in Windows guest

I want to create a Selenium grid hosted in my ubuntu linux 12.04.
My goal is to make this selenium grid communication with a Windows VM with a node role.
My problem is that when i create the selenium grid in the Windows VM i have this error
14:35:00.200 INFO - Registering the node to the hub: http://xxxxx:4444/grid/register
16:35:01.232 INFO - Couldn't register this node: Error sending the registration request: Connect to xxxxx:4444 [IP] failed: Connection refused: connect
My VM is a Windows XP. I try to disable the Firewall.
I'm sure that is a Ubuntu problem, because with an other Windows VM, the problem is the same. I can ping Host to Guest and Guest to Host
In ubuntu, i disable the firewall too, but nothing change.
In ubuntu i declare the hub like this
java -jar selenium-server-standalone-2.52.0.jar -role hub
In the Windows VM i declare the node like this
java -jar selenium-server-standalone-2.52.0.jar -role node
Any ideas about what is blocking the communication ? Thanks for help _
make sure during the virtualization process, the ports 4444 for the grid and 5555 for the nodes are being opened.
Then in your node role, make sure to specify the -hub parameter. when not specifying the hub parameter, it defaults to localhost.

Can't access tomcat web page from lan

I installed a tomcat7 server on a ubuntu 12.04 box. I simply used "apt-get install tomcat7". I did not install apache2. I can access the default page from localhost:8080, 127.0.0.1:8080, and 192.168.1.201:8080, where the latter is the IP address from my LAN. my end goal is to be able to access the web server from outside the LAN with port forwarding. For now, however, I can't even access it inside the LAN.
Problem:
I can't access the web page from any other computer (windows 7, iPad) on the same LAN! I
get the "connection has timed out" error from the browser.
Question: Can I run tomcat on it's own without installing Apache2 first? This is the current setup and I can access pages hosted on tomcat on the same server, but not over the LAN.
Other information:
I can ping the ubuntu computer from other machines
The ubuntu firewall is disabled (checked via the firewall GUI interface).
I also tried "sudo ufw disable"
I tried: "sudo service iptables stop" and got the message: "iptables: unrecognized service"
I also tried disabling the appArmor firewall:
sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor teardown
sudo update-rc.d -f apparmor remove
I set the router firewall policy to minimum: inbound: accept all; outbount: accept all.
All computers (including ubuntu server) are connected to LAN via wireless
The ubuntu server IP address is static, not DHCP
I checked the SELinux folder and it's empty. I removed it.
Thank you for your help,
Omar
EDIT:
I can connect from within the LAN using ssh (I installed OpenSSH on ubuntu).
ANSWER:
I found the solution to this problem. It turned out there was a firewall active that was blocking the port. The firewall is called "firestarter". Not sure how this was installed, but it can be downloaded from the ubuntu software center. The default inboud policy blocks all ports except for SSH (22). I opened port 8080 and everything worked just fine. The other firewalls (ufw and SELinux) were disabled.
Thank you all again for your help.
Omar
First of all make sure all of the IP addresses are topologically correct, then ping to the your apache server system, If all this succeeds your network is fine.
Now the question are you using the Ubuntu Server edition? if this is the case i believe you can setup apache out of the box.
In case of the Desktop edition you could install it using command line or just install something like XAMP from apache friends.
Make sure your apache Server is started
If you do not already have Apache installed, you can do so now by issuing the following commands:
sudo apt-get update
sudo apt-get install apache2
This is all that is necessary to have a working web server.
I think, "apt-get install tomcat7" doesnt works in Ubuntu. You have to manually download the TAR file & then you can install it with the scripts. Please check whether it is properly installed or not. it should show a Apache Tomcat Homepage # localhost:8080
Also if it is installed properly, check whether it is running on the port 8080, or any other port.
If everything is fine, then disable the firewall of the Server, where you have installed the Tomcat. check for the server IP.
Now from other machine, access that server using http://server_ip:port
This should work fine. No issues should be there.
The other thing, you have metioned in your question, UBUNTU BOX. May be this issue arises due to UBUNTU BOX. If possible, make a clean install of Ubuntu.

Resources