Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

How to implement a Php (laravel) website trough Nginx reverse proxy?

$
0
0
Hello, I want to make a Laravel app that serves as DDoS protection. The goal is to show a challenge page to users and when they solve the captcha to get redirected to the website.

As for server configuration so far I've made a Nginx reverse proxy server which leads to the server where is the website.

At the moment if a user types `www.website.com` it will first go trough the reverse proxy and than will open the website. I want to implement the Laravel app here on the reverse proxy server.

Reverse proxy configuration:

server {

#Charset
charset utf-8;

listen 80 default_server;
server_name www.website.com website.com;
client_body_timeout 5s;
client_header_timeout 5s;

location / {
proxy_set_header Host $host;
proxy_pass http://xxx.xxx.xxx.xxx/; #upstream ip
}

#Logs
error_log /var/log/nginx/errors.log;
access_log /var/log/nginx/access.log;

#Show Real IPs
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;

# use any of the following two
real_ip_header CF-Connecting-IP;

}

So my question is how to tell the reverse proxy server if a user hits the home page `www.website.com` to get redirected to the website which is on the other server and if it is another page lets say `www.website.com/about` to get redirected to the captcha challenge which is stored in /var/www/challenge ?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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