Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Nginx Reverse Proxy / Mirror Site / Virtual Host Problem

$
0
0

Everyone.

Yesterday i did good of my experiment with nginx, but suddenly my nginx was suddenly error (can't reboot or stop or start) and i had to reinstall it.

But i forgot the code.

So the .conf would help you process to the other web. for Example :My IP Server : 192.302.xx.xxxI set listen port to : 3000

I only type 192.302.xx.xxx:3000 and then my ip would show up the proxy pass for example watching youtube, it would become like this 92.302.xx.xxx:3000/v=watch?4hnb32yh even it linked when i press the button in my ip, even the blocked site from my local gov. all i need is only change the proxy pass. For example : Adult Videos Site, etc (Except site that reverse proxy like cloudflare one)

And today i want to recreate that one but it fails, these are my code

upstream backend_mirrors {    server anotherwebsite1.id;    server anotherwebsite2.com;}server {    listen 3000;    listen [::]:3000;    server_name 192.302.xx.xxx;     return 301 https://website_that_i_want_togo/$request_uri$is_args$args;}server {    listen          433 ssl;    listen          [::]:433 ssl;    server_name     192.302.xx.xxx;     ssl_certificate "/etc/letsencrypt/live/myservername/fullchain.pem";    ssl_certificate_key "/etc/letsencrypt/live/myservername/privkey.pem";    #include /etc/letsencrypt/option-ssl-nginx.conf;    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;    ssl on;    ssl_session_cache  builtin:1000  shared:SSL:10m;    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';     ssl_prefer_server_ciphers on;    ssl_stapling on;     ssl_stapling_verify on;    ssl_session_timeout 1d;    ssl_session_tickets off;    location / {         resolver 8.8.8.8;        mirror /mirror;        mirror_request_body on;        proxy_set_header   Host               $host;        proxy_set_header   X-Real-IP          $remote_addr;        proxy_set_header   X-Forwarded-Proto  $scheme;        proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;        proxy_pass https://website_that_i_want_togo/;    }    location /mirror {        internal;        proxy_pass https://givesometraffictootherwebsites/;        proxy_set_header X-SERVER-PORT $server_port;        proxy_set_header X-SERVER-ADDR $server_addr;        proxy_set_header HOST $http_host;        proxy_set_header X-REAL-IP $remote_addr;    }    location ~ \.php$ {        try_files $uri =404;        fastcgi_pass unix:/var/run/php5-fpm.sock;        fastcgi_index index.php;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        include fastcgi_params;    }}

What i want to :192.138.xx.xxx:3000 but i can open some other website like blocked websites from domain sites.But the ip address still with it when i change to other page192.138.xx.xxx:3000/search but it still full function like the website that i put in proxy_pass

But what my code do :It's auto redirect to proxy_pass sites even the header changed


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>