|
| 1 | +## |
| 2 | +# You should look at the following URL's in order to grasp a solid understanding |
| 3 | +# of Nginx configuration files in order to fully unleash the power of Nginx. |
| 4 | +# https://www.nginx.com/resources/wiki/start/ |
| 5 | +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ |
| 6 | +# https://wiki.debian.org/Nginx/DirectoryStructure |
| 7 | +# |
| 8 | +# In most cases, administrators will remove this file from sites-enabled/ and |
| 9 | +# leave it as reference inside of sites-available where it will continue to be |
| 10 | +# updated by the nginx packaging team. |
| 11 | +# |
| 12 | +# This file will automatically load configuration files provided by other |
| 13 | +# applications, such as Drupal or Wordpress. These applications will be made |
| 14 | +# available underneath a path with that package name, such as /drupal8. |
| 15 | +# |
| 16 | +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. |
| 17 | +## |
| 18 | + |
| 19 | +# Default server configuration |
| 20 | +# |
| 21 | +server { |
| 22 | + listen 80 default_server; |
| 23 | + |
| 24 | + location /hbnb_static { |
| 25 | + alias /data/web_static/current/; |
| 26 | + } |
| 27 | + |
| 28 | + location /airbnb-onepage/ { |
| 29 | + include proxy_params; |
| 30 | + proxy_pass http://0.0.0.0:5000/airbnb-onepage/; |
| 31 | + } |
| 32 | + |
| 33 | + error_page 404 /404.html; |
| 34 | + location = /404.html { |
| 35 | + root /var/www/html; |
| 36 | + internal; |
| 37 | + } |
| 38 | + |
| 39 | + listen [::]:80 default_server; |
| 40 | + |
| 41 | + # SSL configuration |
| 42 | + # |
| 43 | + # listen 443 ssl default_server; |
| 44 | + # listen [::]:443 ssl default_server; |
| 45 | + # |
| 46 | + # Note: You should disable gzip for SSL traffic. |
| 47 | + # See: https://bugs.debian.org/773332 |
| 48 | + # |
| 49 | + # Read up on ssl_ciphers to ensure a secure configuration. |
| 50 | + # See: https://bugs.debian.org/765782 |
| 51 | + # |
| 52 | + # Self signed certs generated by the ssl-cert package |
| 53 | + # Don't use them in a production server! |
| 54 | + # |
| 55 | + # include snippets/snakeoil.conf; |
| 56 | + |
| 57 | + root /var/www/html; |
| 58 | + |
| 59 | + # Add index.php to the list if you are using PHP |
| 60 | + index index.html index.htm index.nginx-debian.html; |
| 61 | + |
| 62 | + server_name _; |
| 63 | + add_header X-Served-By $hostname; |
| 64 | + rewrite ^/redirect_me https://onepunchcoder.medium.com permanent; |
| 65 | + rewrite ^/redirect_me https://www.onepunchcoder.medium.com permanent; |
| 66 | + |
| 67 | + location / { |
| 68 | + # First attempt to serve request as file, then |
| 69 | + # as directory, then fall back to displaying a 404. |
| 70 | + try_files $uri $uri/ =404; |
| 71 | + } |
| 72 | + |
| 73 | + # pass PHP scripts to FastCGI server |
| 74 | + # |
| 75 | + #location ~ \.php$ { |
| 76 | + # include snippets/fastcgi-php.conf; |
| 77 | + # |
| 78 | + # # With php-fpm (or other unix sockets): |
| 79 | + # fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; |
| 80 | + # # With php-cgi (or other tcp sockets): |
| 81 | + # fastcgi_pass 127.0.0.1:9000; |
| 82 | + #} |
| 83 | + |
| 84 | + # deny access to .htaccess files, if Apache's document root |
| 85 | + # concurs with nginx's one |
| 86 | + # |
| 87 | + #location ~ /\.ht { |
| 88 | + # deny all; |
| 89 | + #} |
| 90 | +} |
| 91 | + |
| 92 | + |
| 93 | +# Virtual Host configuration for example.com |
| 94 | +# |
| 95 | +# You can move that to a different file under sites-available/ and symlink that |
| 96 | +# to sites-enabled/ to enable it. |
| 97 | +# |
| 98 | +#server { |
| 99 | +# listen 80; |
| 100 | +# listen [::]:80; |
| 101 | +# |
| 102 | +# server_name example.com; |
| 103 | +# |
| 104 | +# root /var/www/example.com; |
| 105 | +# index index.html; |
| 106 | +# |
| 107 | +# location / { |
| 108 | +# try_files $uri $uri/ =404; |
| 109 | +# } |
| 110 | +#} |
0 commit comments