Last active
December 17, 2017 09:52
-
-
Save sujalpatel2209/aa3425530f43485a75447c0bb9a3bd3d to your computer and use it in GitHub Desktop.
Nginx default config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default; | |
#listen[::]:80 default; | |
root /var/www/html; | |
# index index.html index.htm index.nginx-debian.html; | |
server_name example.com www.example.com; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
server_name example.com www.example.com; | |
root /var/www/html; | |
location / { | |
# 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; | |
} | |
location ~ /\.well-known { | |
root /var/www/html; allow all; | |
} | |
location /blog { | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options "nosniff"; | |
index index.html index.htm index.php; | |
charset utf-8; | |
try_files $uri $uri/ /index.php?$query_string; | |
# location ~ /\.well-known | |
# { | |
# | |
# root /var/www/html; allow all; | |
# } | |
location /blog/api { | |
try_files /wmtblog/#/$uri /wmtblog/#/$uri/ /wmtblog/index.php?q=$uri&$args; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
location /mobileapp { | |
try_files /mobileapp/$uri /mobileapp/$uri/ /mobileapp/index.php?q=$uri&$args; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~* \.(js|jpg|png|css|ttf|woff)$ { | |
root /var/www/html; | |
expires 30d; | |
} | |
} | |
location /api { | |
try_files /api/$uri /api/$uri/ /api/index.php?q=$uri&$args; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~* \.(js|jpg|png|css|ttf|woff)$ { | |
root /var/www/html; | |
expires 30d; | |
} | |
} | |
location /hradmin { | |
client_max_body_size 8M; | |
root /var/www/html; | |
index index.php index.html index.htm; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
# location /placement { | |
# | |
# root /var/www/html/; | |
# index index.php index.html index.htm; | |
# | |
# | |
# try_files $uri $uri/ /placement/index.php/; | |
# | |
# | |
# location /placement/index.php { | |
# | |
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
# fastcgi_param SCRIPT_FILENAME /var/www/html/placement$fastcgi_script_name; | |
# include fastcgi_params; | |
# } | |
# | |
# location ~ \.php$ { | |
# | |
# try_files $uri =404; | |
# fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
# fastcgi_index index.php; | |
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
# include fastcgi_params; | |
# } | |
# | |
# | |
# } | |
location /hub { | |
root /var/www/html; | |
index index.php index.html index.htm; | |
# try_files $uri $uri/ /index.php$is_args$args; | |
try_files $uri $uri/ /index.php$is_args$args /hub/index.php?$args; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location /phpmyadmin { | |
client_max_body_size 8M; | |
# auth_basic "Restricted Content"; | |
# auth_basic_user_file /var/www/.htpasswd; | |
root /var/www/html; | |
index index.php index.html index.htm; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
location /privacypolicy { | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
if ($scheme != "https") { | |
return 301 https://$host$request_uri; | |
} # managed by Certbo | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment