I am trying to create a bot. Using this project. My setup is as follows:
Amazon EC2 instance. I created a sub-domain.domain.com I have added the ssl certifications. I have pointed the sub-domain to the /var/www/sub-domain/
I have installed the unzip and installed the project in /var/www/sub-domain/project/ I have configured the project and correctly run it:
Node app is running on port 5000
If I access http://sub-domain.domain.com:5000 I access to the projects public index. I understand that means the port is open and the node app works.
Now when I am trying to configure in facebook my webhook I dont understand what url callbak to use. From what I understand in the configuration the server url whould be https://sub-domain.domain.com and the configuration should work. but it doesnt.
What url should I use?
Your callback URL should be your actual file where facebook would send user data. Like if you were using PHP, you'd say: http://yourhost/chatbot.php. Currently, webhook would be the URL on which your node app is listening.
Your webhook needs to an accessible URL. I don't know which sample code you used, but my guess is that with your current set up you should use http://sub-domain.domain.com:5000/webhook.
You can use Apache or Nginx to make it accessible on http://sub-domain.domain.com/webhook (port 80) with ProxyPass/proxy_pass directives.
I have installed the unzip and installed the project in /var/www/sub-domain/project/ [...] I access to the projects public index
The Javascript files of your project don't need to and should not be accessible to the public, as they may contain your application's secret IDs and tokens.
Related
I'm developing a web app using Next.js that is, in the end, served by a custom Express.js server. I'm trying to deploy this app on EC2 and access it but I'm getting ERR_CONNECTION_REFUSED errors.
I'm accessing the app over HTTP using the public DNS of my instance (http://ec2-PUBLIC_IPV4_ADDRESS.compute-1.amazonaws.com/) which works fine, the index.html then needs to load other files (e.g.: .js or .css files), but tried to load them over HTTPS (https://ec2-PUBLIC_IPV4_ADDRESS.compute-1.amazonaws.com/style.css). In the network tab of the developer tool of Chrome, I get one request that is succesful and other assets that fail with net::ERR_CONNECTION_REFUSED.
I was wondering if there is a config either on my EC2 instance, on my Express server or even on Next.js that needs to be modified to make sure that the connection is not upgraded to HTTPS.
I would prefer to find a solution that doesn't involve setting up a domain for early testing purposes.
Thanks in advance.
I've created a website using html,css,sass,js, node, express & ejs. Do I need to make any changes in the code to deploy it over the web?
P.S. I've set the port to process.env thing and added the css & js files to a public folder. Are there any other changes I need to make?
Not sure what you are asking.
You basically need to make it publicly available.
You could either do it using a host provider or in theory you could set up your own server using apache ,nginx etc then reroute your home router to your machine (laptop).
Your server will run the same way as locally in theory.
You just need something to redirect the traffic in and out.
I have 2 separate code of node application. I have already deployed node code on a windows server. Code runs on port 80 so when I hit my domain like www.myproject.com it loads my home page of my node server.
When I hit www.myproject.com/admin it should give me the admin page form my other node js code.
You are a bit short on information in your question, but I'll do my best with what you've given. Assuming you have 2 instances of node on your machine, but want a user to only access one, and you are using express, I would suggest an http proxy on one to route to the other such as:
https://www.npmjs.com/package/express-http-proxy
Setup your /admin route to access your uri of your 2nd instance. Hope that helps.
I got an Amazon ec2 server and when I go to the URL (Public DNS (IPv4)) in my browser I get "ERR_CONNECTION_TIMED_OUT"
I did the tutorial "Installing a LAMP Web Server on Amazon Linux" http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
But got stuck on "If you are unable to see the Apache test page, check that the security group you are using contains a rule to allow HTTP (port 80) traffic."
I checked the security groups and they both set to "All traffic
All
All
sg-7496280c (default)"
And I still can't see the test page. I've also tried using the public IP address and I get the same thing.
There were no errors when installing packages.
I am able to connect using winSCP and upload html files but it doesn't serve them.
I don't know if I'm doing the right tutorial, or if I need to do other things first, or which tutorials apply to which types of servers or if ec2 and aws are the same thing or not etc.
I tried contacting support but it said I don't get technical support for basic accounts. I tried posting this on Amazon forums but it said something like "you can't post new threads right now, try again later"
I'm only doing any of this because you can't run node.js on hostgator.
ERR_CONNECTION_TIMED_OUT only happen either your apache not running or your server or your server is redirecting too much
Just I am unsure where you uploaded your HTML file and with what permission.
Do the basic thing reinstall only apache first.
check in your inbound and outbound port in aws security group in aws dashboard
if 80 port is open with anywhere option
check for
security rule
See if apache default page come. then upload your file.
can you tell in what directory you uploaded all your HTML
"ERR_CONNECTION_TIMED_OUT" can also be happen if you have not properly configure security group while creating the EC2 instance as it allows specific traffic to reach your instance.
If you want to set up a web server and allow Internet traffic to reach your instance, add rules that allow unrestricted access to the HTTP and HTTPS ports.
and copy Public IPV4 and use to visit the webpage rather than copying the url.
I'm deploying a simple node.js app and I'm using apache as a web server. I installed apache correctly and the only thing I changed in the httpd.conf file was the DocumentRoot and Directory. I pointed these to the directory of my node application. I restarted apache and when I go to the public IP I only see the apache testing page?? However if i curl the private IP address.. with the port extension (:8000) than it returns the index page of my app. How do I get apache to send the request to the correct port ?
Edit: If I curl just the private IP address it returns the html for the Apache testing page.
You proxy the request from Apache to Node rather than try to make Apache call the node command directly (like you would do with PHP).
You can do this with config like this:
ProxyPass /app http://127.0.0.1:8000
This means if you go to https://www.example.com/app then you will be calling your node service.
You can of course ProxyPass / so everything goes to your node service, but most people find it's best to allow the web server to handle static pages and resources (as its good at that) and then have node return dynamic content - either directly returning HTML or just returning data in JSON format and the front end javascript using that data.