How to run my ruby on rails website on AWS? - amazon-web-services

I have my rails 5 website on an AWS server, everything works fine for me but i need to change region due to problems with sending emails, i created an image of my instance using the information in this web page and then i executed it specifying the new region but when i tried to access through the ipv4 address the page stays loading and doesn't show me my website that worked well in the other instance, i tried to access through the console using the key pair and all the files from my previous instance are there. my server uses nginx. what could be missing?

You may be trying to access the old IP address. When you moved the instance to a new region it will get a new IP address.
Another possibility is that the web server on the server was not started automatically. You may have to configure that to start on boot. The procedure may depend on how you set up the server.

Related

Hosting Back end Application with API on EC2 instance

I'm quite new to AWS and I have been starting to work with EC2 instances. I have a web application that has a frontend and backend separately. So first I hosted the backend application on EC2 instance and it is a Symfony framework based REST API Application. So I have installed all dependencies and now the application is running. But to check the application I ran some API calls to the application using postman and seems application is not working as intended. I get following response from Postman. I have also provided security group configurations properly.
When I start sysmfony app it says [OK] Server listening on http://127.0.0.1:8000.
Can't figure out why this is happening. Can someone help me here?
You are running your application trough CLI (Symfony web server bundle) , by default this will bind to 127.0.0.1 which can't be accessed from outside. To fix this, you must bind to your server's public IP/hostname and port:
php bin/console server:start 192.168.1.1:8000 # replace with your ip
You can also bind to all your IP addresses using 0.0.0.0
But keep in mind, you should not use built in server for production, it's slow and less secure. Use a real web server instead, like Apache or Nginx.

Django go live with Nginx from server on local network

I followed this tutorial to test going live with a django website.
I don't have a DigitalOcean droplet but a local machine I have that eventually could be used as a server. Therefore, in the steps where I had to put the domain name I used the local machine IP address (it's the same IP address I use to login with ssh).
All steps were ok and I have a response from whitin the local machine, i.e., if I open a browser in the local machine and with the IP address, the Django app runs ok.
However, the same does not happen if I open it from an external computer. I'm not sure if it was suppose to work like that. Is it? If not what extra steps do I need to do to go public?

Port blocked creating web app on AWS

I'm trying to create a web app on AWS and I'm running into port issues. I would like to have multiple apps providing different services on different ports. I've created a website (on the same instance) to receive a text query and pass it to my app on port 3000. The app listening on 3000 is written in CherryPy.
We are using a VPN to provide security for the AWS instance. When logged into the VPN, everything works fine. The web page loads, the query returns the correct data. When I disconnect from the VPN, or someone else goes to the page, the page still loads, but queries to the service time out.
I've used netstat to make sure the service is listening but I'm not sure what could be blocking traffic. I've worked through the CORS issues as evident by the fact it works when I'm signed into the VPN.
What can I check now?
When I disconnect from the VPN, or someone else goes to the page, the page still loads, but queries to the service time out.
My assumption is that the web server and the app are on the same server.
It sounds very much like the connection from web server to app is happening via a routed IP address rather than localhost. In addition to being slower, it's also hitting your firewall rules.
Configure the web server to access your app on localhost:3000 and the issue should clear up.
I actually got it working. I have an AWS instance with nginix and CherryPy. When the user goes to a web address, the nginix page loads with a form for a query string. When they submit a string, the string is POSTed to a CherryPy service running on port 3000. The CherryPy service does some computations and returns a result via JSON.
I thought I had opened up everything completely for testing, but I was having so many issues. It turned out that having CherryPy set
"Access-Control-Allow-Origin" = "*"
wasn't working, instead I needed to specifically set the origin of the calling page.

Shibboleth bypass for IP range

I have Shibboleth configured on an IIS server and am using it protect a .NET application.
I need authenticated access for users accessing the application over the web and for that Shibboleth is working fine.
The application also hosts web services which need to be accessed by other applications in the same server and for that working with Shibboleth is a challenge since web service clients cannot deal with the log in page.
Is it possible to configure Shibboleth to ignore requests coming from the same server for example by checking the IP address?
It won't directly answer your question, but I can share a workaround I found and hope it can help with your problem too.
Define another website in IIS pointing to the same folder as the initial one, and make it only respond to a different domain (like something.local). Then in IP Address and Domain Restrictions, make sure only 127.0.0.1 is allowed to access it.
In C:\Windows\System32\drivers\etc open the file "hosts" in Notepad (running with Administrator privileges). Add the line "127.0.0.1 something.local" (no quotes; make sure the domain is the same one you defined before)
Now, make the webservices call the application by the new domain.

How do you change the DNS for a website hosted on an Azure Linux server VM?

I have a website running CMSMadeSimple on an Azure Linux VM. The current URL is [website].cloudapp.net/cmsmadesimple, but now that the site is complete I need to change the it to the client's URL [website].com.
I've done this in the past by simply remoting in to the server and changing the DNS records, but since the VM is Linux, I can't just remote it. I've looked around but have yet to find a solution.
What am I missing here?
Just create a CNAME or A record. However, your application server must cooperate by redirecting the request to your new hostname to the existing application. It's likely a VirtualHost is already setup for this but if you get a 404 then you need to "remote" in.
First update the config.php files for the new domain.
Second update your vhost files on your webserver to listen to the new domain.
Final update the DNS (usually it is where you registered the domain -- like godaddy.com, namecheap.com, etc) to point to the IP or alias given to you by Azure.