-
-
Save xameeramir/a5cb675fb6a6a64098365e89a239541d to your computer and use it in GitHub Desktop.
# Author: Zameer Ansari | |
# 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; | |
# } | |
#} |
Thanks!
Thanks :)
Oh man. So many goofs in the world that delete this file on their server. Including me :-) Thank you so much!!!
When I downloaded nginx for whatever reason it did not come with the sites-available and sites-enabled folder, not sure why. Anyways thanks for this. Does the default file inside sites-available have a file extension?
My default file does not have a file extension.
Thanks for the gist!
thanks, you gist helped me
Shit man i thought that said muslims are terroists. Was about to report it 😂
ho so everyone think its normal to have
Personal note: Muslims are not terrorists and I humbly request my engineering community to help end racism. at the very first line without any introduce or any link ? u choked me
I'm sure this is needed for proper configuration
i now know why this config file outputs an error...
It's a comment, it's not going to output an error because of it. Remove it and try it if you don't believe me.
Thanks
Thanks!
Thanks!!
thanx bro
ok but what is that comment at the very top
Is this like the default nginx.conf file just with that agenda of yours ? We don't care if you're muslim, christian or you believe in ancient aliens, nor what's your skin colour. This is open-source. Any creature/being/entity can contribute to the whole cause
@gyrusdentatus It's not the nginx.conf file, this is config file for a virtual host usually found in /etc/nginx/sites-available/default.conf
Hey, check the previous comment
Hello I want to write this content in this file
`
location / {
proxy_pass http://localhost:3000; #whatever port your app runs on
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;
}
`
how can I do that. The solution I came up with is that to remove the whole file and paste the whole content again. This has to be this way because this is going into EC2 user data so this command have to run own there own. So the problem I am facing is that I removed the file but when I want to create the file it has no extension what do I do now. If someone have a solution it will be very helpful and is a better approach then it will also be very helpful.
@gyrusdentatus It's not the nginx.conf file, this is config file for a virtual host usually found in /etc/nginx/sites-available/default.conf
that is exactly what I meant. I thought it was obvious ^^
You saved me , Thanks :)
thank you man!
Thanks!
Thank you!
goated
I have created a new Gist that will not be edited to promote ideologies (or anything else).
You can find it here, it has both this file and nginx.conf: https://gist.github.com/MiranDaniel/7d0dfe222fbc79c1126899cb51baefb2
Thank you!!!