diff --git a/0x1A-application_server/3-app_server-nginx_config b/0x1A-application_server/3-app_server-nginx_config index e832836..2064ba6 100755 --- a/0x1A-application_server/3-app_server-nginx_config +++ b/0x1A-application_server/3-app_server-nginx_config @@ -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; + } } \ No newline at end of file