Skip to content

Commit

Permalink
Attempt 1
Browse files Browse the repository at this point in the history
  • Loading branch information
AyomideA-S committed Aug 24, 2024
1 parent 3d1e9f6 commit 304e756
Showing 1 changed file with 41 additions and 23 deletions.
64 changes: 41 additions & 23 deletions 0x1A-application_server/3-app_server-nginx_config
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
server {
listen 80 default_server;
location /hbnb_static { alias /data/web_static/current/;}
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html
server_name_;
add_header X-Served-By $hostname;
location / {
try_files $uri $uri/ =404;
}
location /airbnb-onepage {
proxy_pass http://0.0.0.0:5000/airbnb-onepage;
}
location ~ ^/airbnb-dynamic/number_odd_or_even/([0-9]+)$ {
proxy_pass http://0.0.0.0:5001/number_odd_or_even/$1;
}
if ($request_filename ~ redirect_me){
rewrite ^ https://th3-gr00t.tk/ permanent;
}
error_page 404 /error_404.html;
location = /error_404.html {
internal;
}
listen 80 default_server;
listen [::]:80 default_server;
server_name _;

root /var/www/html;
index index.html index.htm index.nginx-debian.html;

add_header X-Served-By $hostname;

location / {
try_files $uri $uri/ =404;
}

location /hbnb_static {
alias /data/web_static/current/;
}

location /airbnb-onepage {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location ~ ^/airbnb-dynamic/number_odd_or_even/([0-9]+)$ {
proxy_pass http://127.0.0.1:5001/number_odd_or_even/$1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /redirect_me {
return 301 https://th3-gr00t.tk/;
}

error_page 404 /error_404.html;
location = /error_404.html {
internal;
}
}

0 comments on commit 304e756

Please sign in to comment.