Results 1 to 6 of 6
-
08-28-2022, 03:47 PM #1Junior Guru Wannabe
- Join Date
- Jul 2014
- Posts
- 44
Can someone validate my nginx reverse proxy config
Hi guy's, i made my reverse proxy config and want to know if i made any mistake from what i have learn so far :
server {
listen 80;
server_name www.website01.com;
location / {
proxy_pass http://www.website01.com;
}
server {
listen 80;
server_name http://www.website02.com;
location / {
proxy_pass http://www.website01.com;
}
server {
listen 80;
server_name http://www.website03.com;
location / {
proxy_pass http://www.website01.com;
}
Regards Peter
-
08-29-2022, 11:21 AM #2Knowledge is all
- Join Date
- Jul 2005
- Location
- here, there, where?
- Posts
- 4,102
1. server_name should only be the server address, not including http://
2. You are creating a infinite proxy - nginx will connect to it self - you need the proxy pass to use the backend server port. The proxy_pass needs to beCode:proxy_pass http://www.website01.com:backend_server_port;
-Steven | Cooini, LLC
"It is the mark of an educated mind to be able to entertain a thought without accepting it" -Aristotle
-
08-29-2022, 02:33 PM #3Junior Guru Wannabe
- Join Date
- Jul 2014
- Posts
- 44
Hi Steven and again thank for your kind help and patience for my lack of understanding of the reverse proxy concept.
Everything was going fine on my vps setup until this reverse proxy thing sent me on almost a week of reading and headaches!
By looking at the code i have post i already notice that i have made big mistake since i am making an endless loop by redirecting the first server block on itself and i also forgive to close brackets because i didn't made clean indentation.
What put a lot of confusion regarding this topic is that most people using it are using it to redirect to a node.js or an app but i think i haven't see any guides showing it for simple independent websites.
Maybe i am over doing thing and i don't really need to use a reverse proxy on my vps setup since i am already under ssh and i will also have https/ssl on my server block.
My only goal is to secure as much as i can my 3 websites with my limited knowledge on server configuration.
If someone can tell me if i really need a reverse proxy and how to implement it i am eager to learn how to properly do it.
For all the rest i was OK and didn't have any problem setting up my server block it's only when i got to the reverse proxy thing that i was stuck!
Regards Peter
-
08-29-2022, 03:01 PM #4Knowledge is all
- Join Date
- Jul 2005
- Location
- here, there, where?
- Posts
- 4,102
Honestly, I would just advise to use Plesk or other control panels that offer what you need. Dealing with configs can be a pain at times if you are not familiar with them - and sometimes even if you are. If you are using Node.js, Plesk has support for that out of the box. Sure Plesk isn't free but is you time?
With that said, lets look at the node.js as an example. In the node.js server.listen, you give it a port to use as the first argument:
Code:server.listen(7743)
Code:proxy_pass http://www.website01.com:7743;
-
08-29-2022, 03:17 PM #5Junior Guru Wannabe
- Join Date
- Jul 2014
- Posts
- 44
Hi again Steven and unfortunately since i am on disability without any insurance i can barely making it from month to month so paid solution for the moment are impossible but once my game is on sale thing may get better and i would probably hire a professional to do so since the game dedicated server is surely way too complicated for me to handle.
Thank for the example with node.js but i wont need anything like this, i was only trying to set this reverse proxy to get better security for my 3 websites host on same vps.
Regards Peter
-
08-29-2022, 05:46 PM #6Junior Guru Wannabe
- Join Date
- Jul 2014
- Posts
- 44
I made a diagram about how i see it
I made a diagram to explain the way i am understanding the reverse proxy thing, i don't know if it make sense but if so what would the reverse proxy config would look like, for me i see it this way here :
In the example i am thinking as the vps main server to be like a fake server only displaying the welcome to nginx and all other websites pointing to it. The goal is to hide the 3 websites from prying eye but again i am probably wrong with this idea.
https://imgur.com/GkIVvaL
Code:server { listen 80; server_name www.website01.com; } server { listen 80; server_name www.website01.com; } location / { proxy_pass 118.233.1.1; } server { listen 80; www.website02.com; } location / { proxy_pass 118.233.1.1; } server { listen 80; server_name www.website03.com; } location / { proxy_pass 118.233.1.1; }
Similar Threads
-
Can someone help me understand reverse proxy with nginx
By pixelquaternion in forum Web HostingReplies: 6Last Post: 08-24-2022, 09:11 PM -
How can I optimize Apache + Nginx reverse proxy effectively
By pmjcreations in forum Web HostingReplies: 0Last Post: 10-02-2019, 03:45 AM -
Can I setup an nginx reverse proxy alongside cPanel?
By Mentorforums in forum Dedicated ServerReplies: 7Last Post: 03-31-2013, 12:42 PM -
Will my nginx reverse proxy cache work?
By Akufoo in forum Web HostingReplies: 3Last Post: 09-23-2012, 12:33 AM -
Can someone tell my about http://www.efreeservers.com/
By hvdm_20 in forum Web HostingReplies: 1Last Post: 04-05-2001, 10:27 AM