Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The default nginx configuration file inside /etc/nginx/sites-available/default
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# proxy_pass http://localhost:8080;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
@PR4M

This comment has been minimized.

Copy link

commented Mar 16, 2018

Thank you for preserving this, I deleted it by accident and just copy this gist to restore it

@mrudav-shukla

This comment has been minimized.

Copy link

commented Apr 3, 2018

This helped! Thanks!

@nayods

This comment has been minimized.

Copy link

commented May 1, 2018

Thanks this is very nice of you to have this placed here. I have enjoyed and kind gesture.

@sweettirexkiller

This comment has been minimized.

Copy link

commented Jun 12, 2018

Thanks!

@LOUD-Mining

This comment has been minimized.

Copy link

commented Jul 18, 2018

Accidentally borked my webserver and this has helped TREMENDOUSLY!

@easybeau

This comment has been minimized.

Copy link

commented Jul 25, 2018

Thanks

@Poldovico

This comment has been minimized.

Copy link

commented Jul 29, 2018

Thank you for this. I deleted mine by accident and you just saved me a big headache!

@mabdullahejaz

This comment has been minimized.

Copy link

commented Aug 8, 2018

Thanks

@gozhev

This comment has been minimized.

Copy link

commented Aug 20, 2018

thank you

@JamesTheHacker

This comment has been minimized.

Copy link

commented Sep 13, 2018

Deleted by accident. Lifesaver!

@fkm

This comment has been minimized.

Copy link

commented Sep 20, 2018

Thank you!

@smndiaye

This comment has been minimized.

Copy link

commented Sep 24, 2018

thanks !

@sammann-fnordbedarf-de

This comment has been minimized.

Copy link

commented Oct 2, 2018

Thank you!

@pstjean

This comment has been minimized.

Copy link

commented Nov 21, 2018

The Debian package version of this file can be found here: https://salsa.debian.org/nginx-team/nginx/blob/master/debian/conf/sites-available/default

@KeitelDOG

This comment has been minimized.

Copy link

commented Nov 29, 2018

Thank you guys, I deleted it thinking I was doing vim on it while switching from last commands.

@juliantheberge

This comment has been minimized.

Copy link

commented Dec 26, 2018

thanks!

@johncodeos

This comment has been minimized.

Copy link

commented Jan 19, 2019

Thank you!!

@TheAz928

This comment has been minimized.

Copy link

commented Jan 31, 2019

Thank you!!

@john-osullivan

This comment has been minimized.

Copy link

commented Feb 14, 2019

Count one more reckless deleter helped out -- thank you!

@jerrychong25

This comment has been minimized.

Copy link

commented Feb 17, 2019

Thanks

@rexlManu

This comment has been minimized.

Copy link

commented Mar 9, 2019

Thanks

@aterra1977

This comment has been minimized.

Copy link

commented Mar 15, 2019

Obrigada.

@helpse

This comment has been minimized.

Copy link

commented Mar 15, 2019

<3333

@harleyday

This comment has been minimized.

Copy link

commented Mar 19, 2019

Just deleted mine my accident. You've saved me so much hassle! Thanks!

@rajeshisnepali

This comment has been minimized.

Copy link

commented Mar 20, 2019

Thank You.

@almokhtarbr

This comment has been minimized.

Copy link

commented Apr 6, 2019

Thank youuuuu

@flads

This comment has been minimized.

Copy link

commented Apr 12, 2019

Valeu irmão!

@vicpb

This comment has been minimized.

Copy link

commented Apr 14, 2019

Thanks!!

@ankyit

This comment has been minimized.

Copy link

commented Apr 17, 2019

Thanks !!

@Mdauphin42

This comment has been minimized.

Copy link

commented May 27, 2019

All heroes don't wear capes ! thanks you

@modem7

This comment has been minimized.

Copy link

commented Jun 12, 2019

Consider me thankful Sir Hero!

@jasonthiago

This comment has been minimized.

Copy link

commented Jul 27, 2019

Thank you!

@ankitghanekar

This comment has been minimized.

Copy link

commented Aug 13, 2019

Hi,

I having 2 react application and I need to configure it on nginx, so in this case what should I do. I am stuck with it?

Thanks in advance,
Ankit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.