This is my first time posting on Stack Overflow.
I'm trying an automation personal project.
My question is: How do I serve the completed web servers from the GitHub repository using NGINX or Apache?
For example, if I made a change to the code. I want to be directly served to the internet by using NGINX.
Any suggestions will do.
Related
The question I am raising here has been asked couple of times and I went through most of them, including stackoverflow posts and other blog posts. The case is that I couldn't find something which fits to my requirement and I'm not gonna play around in our product environment with suggestions.
So the situation is, we have multiple web applications hosted in our tomcat server, deployed in Amazon AWS. Currently we access them like http://<ip-address>:8080/webapp1. Now,
We have sub domains to point at our web apps. So something like portal.example.com will point the above URL.
We have wildcard SSL to implement for domains and sub domains.
Now, first I have to sort the domain pointing thing, which I found 2 separate ways.
Install Apache and do a Virtual Proxy (https://www.digitalocean.com/community/questions/how-to-tie-domain-name-with-application-running-on-tomcat)
Edit Serverl.xml (How to map tomcat 7 webapp to my domain)
Now my questions.
Can someone please advice which method is the best (If non is good, I'm open for others as well).
Which method makes the SSL implementation easy?
If I chose the Apache Virtual Proxy, where should I install SSL? In apache or in Tomcat?
If I chose Server.xml, where should I install SSL? In apache or in Tomcat?
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
In PHP, we have Apache (or Nginx) as the HTTP server. They are also the de-facto standard set up for PHP web development.
In Rust nearly all examples on the web are to run its own HTTP server (or "hyper" library) by "Cargo run" command and then go to localhost in a browser to see the result. It seems nobody would deploy it on Apache/Nginx.
Why are Rust programs not deployed in the existing HTTP servers which provide so many useful and mature features (e.g. VirtualHost, Alias, SSL, mod_rewrite etc.)?
Also, what're the benefits of using this web server over Apache/Nginx?
In a production environment, do you also use hyper library as the web server for Rust?
The common approach when writing a web application in something other than PHP is to use either Apache or NGINX as the public-facing server. You then set up a virtual host in either Apache or NGINX to function as a remote proxy which forwards all connections to your web application (Rust, Golang, Python, Node.js, etc...) which is, itself, running its own server bound to a non-80 port on localhost.
For a (rough) visual example:
+++++++++++++++++++++++ SERVER +++++++++++++++++++++++++++++++++++
+ [Web Application (bound to localhost:8080)] +
+ /|\ +
+ | reverse proxy connection +
+ \|/ +
+ [NGINX (bound to remote_address::80 and remote_address:443)] +
+++++++++++++++++++++++++/|\+++++++++++/|\++++++++++++++++++++++++
| |
\|/ \|/
++++++++++++ ++++++++++++
+ CLIENT + + CLIENT +
++++++++++++ ++++++++++++
This approach is (generally) more secure, allows you to easily use the features of a mature web server like you are saying (e.g. SSL, load balancing, etc.), and allows you to focus on writing a robust web application rather than on writing a robust web server.
Take a look at this article for documentation on how to set up NGINX as a reverse proxy. Although Apache is just as capable, NGINX tends to be the web server of choice when creating a web application and stack like this due to its speed and the fact that it is relatively lightweight.
For what it is worth, the difference between this architecture and what, for example, PHP and Apache look like together is, simply put, that PHP runs as an "extension module" to Apache rather than as an "external component". Actually, when you use PHP with NGINX, you will have to set it up in a very similar way as described in this post.
Doesn't have to be Apache, but that's just the only HTTP server I know of (Actually could you guys recommend alternatives that I could look into as well?)
Anyways, so I have been messing around with Amazon Web Services and I created an EC2 server instance with an Amazon Linux Image. On that, (Following guides and examples) I installed Apache and now when I make a GET request to my public IP, it returns to me the HTML files I created on my server.
My question is, what if I never installed Apache, and then made an HTTP request to my public IP? For no reason really, the question just came up in my head and I'm curious. I'd rather not figure out how to uninstall Apache or create a new instance to figure it out, so I was wondering if somebody could weigh in as well as tell me a little more about what it is exactly apache does on a server. My understanding is that it is a layer you can install on your server OS that will create a socket listener to port 80 (HTTP), and when a request is made on that port, Apache will return web pages? Also I think I read somewhere you could configure Apache to forward a port to something like a python server script?
Thanks in advance for your time!
could you guys recommend alternatives that I could look into as well?)
nginx is a popular alternative to apache. It's much more efficient.
what if I never installed Apache, and then made an HTTP request to my public IP?
Your browser would get a "connection reset" because there is nothing on port 80. Your browser would display a message (Chrome says "This webpage is not available"). You would NOT get a "404" because that requires an HTTP server to send HTTP codes.
If your server was firewalled instead, you'd bet a busy wait for a while, then a message about the server not responding.
Also I think I read somewhere you could configure Apache to forward a port to something like a python server script?
Yes, that is called "reverse proxy" mode. It's essential to any application website if you want to scale. The web server(s) can distribute traffic to one or more backends running the application. The web server is useful for filtering bad requests (since your backend in Ruby/Python will be 1000's of times slower than the reverse proxy.)
Well, if you want to test what will happen if Apache isn't installed, you can always just stop the Apache service by typing:
sudo service apache2 stop
or
sudo service httpd stop
depending on your version. Then if you visit your site's webpage you'll get a 404 error or something similar.
There are ways to use python scripts to run simple servers, but in general it's easier to just let Apache handle that and use a framework like Ruby on Rails or Django to control the display and creation of content for your server.
I am on Dreamhost VPS with root access. It runs Apache, and is hosting a site "www.example.com". At the same time, I am developing a Node.js web site, and binding Node.js to port 3456 (for example). So the Node.js site is accessible by typing "www.example.com:3456".
These are two distinct websites. I don't ever want users of the "www.example.com" accessing my Node.js website (which will be migrated to Nodejitsu after development).
Will I run into any problems with this setup?
I do not believe this will be a problem, unless one of your visitors happens to end up at port 3456. To mitigate this, you should think about writing your own small piece of middleware to whitelist your IP (thus rejecting anyone else). You can see an example at: http://www.hacksparrow.com/how-to-write-midddleware-for-connect-express-js.html. I'm sure you wont have a problem modifying this to your needs.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Why do we need apache under Node.js express web framework?
I wonder why I should install a server such as Nginx or Apache with Node.js. I used to think that the server can help me to handle cache control or something more. But I found out that the Connect static middleware already does it, right?
If you don't know why you need Nginx or Apache on top of Node.js, then you don't need it.
Nginx does a few things faster (and in some cases easier to configure) than Node.js: proxying, url rewriting, http caching, redirection, static file serving, and load balancing.
If you experience that your Node.js code for any of these roles are growing complex, or turn out to be performance bottlenecks, it's worth investigating. Until then, no need to bother.
Using stable and solid web server software as front end can bring several advantages. For example, you can use Nginx for load balancing. Furthermore, security risks can be reduced by not presenting your application server directly to the internet.