1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00

Did changes to nginx.conf

This commit is contained in:
Anmol 2017-07-21 13:44:27 +05:30
parent 6cef0e12f1
commit c6303f8f55

View file

@ -1,13 +1,45 @@
##
# Friendica Nginx configuration
# by Olaf Conradi
#
# On Debian based distributions you can add this file to
# /etc/nginx/sites-available
#
# Then customize to your needs. To enable the configuration
# symlink it to /etc/nginx/sites-enabled and reload Nginx using
#
# service nginx reload
##
##
# 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
##
##
# This configuration assumes your domain is example.net
# You have a separate subdomain friendica.example.net
# You want all Friendica traffic to be https
# You have an SSL certificate and key for your subdomain
# You have PHP FastCGI Process Manager (php5-fpm) running on localhost
# You have Friendica installed in /var/www/friendica
##
location __PATH__ { location __PATH__ {
alias __FINALPATH__/; alias __FINALPATH__/;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
}
#allow uploads up to 20MB in size
client_max_body_size 20m;
client_body_buffer_size 128k;
#Default indexes and catch-all #Default indexes and catch-all
index index.html index.php; index index.php;
try_files $uri $uri/ /index.php?$args; try_files $uri $uri/ /index.php?$args;
#Prevent useless logs #Prevent useless logs
@ -15,14 +47,31 @@ location __PATH__ {
log_not_found off; log_not_found off;
access_log off; access_log off;
} }
location = /robots.txt { location = /robots.txt {
allow all; allow all;
log_not_found off; log_not_found off;
access_log off; access_log off;
} }
# Deny access to hidden files and directories # make sure webfinger and other well known services aren't blocked
location ~ ^/(.+/|)\.(?!well-known\/) { # by denying dot files and rewrite request to the front controller
location ^~ /.well-known/ {
allow all;
rewrite ^/(.*) /index.php?pagename=$uri&$args last;
}
#statically serve these file types when possible
#otherwise fall back to front controller
#allow browser to cache them
#added .htm for advanced source code editor library
location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {
expires 30d;
try_files $uri /index.php?pagename=$uri&$args;
}
#block these file types
location ~* \.(tpl|md|tgz|log|out)$ {
deny all; deny all;
} }
@ -38,15 +87,14 @@ location __PATH__ {
} }
#.htaccess file from Friendica converted using http://winginx.com/en/htaccess #.htaccess file from Friendica converted using http://winginx.com/en/htaccess
location ~ "(^|/)\.git" location ~ "(^|/)\.git" { return 403;}
{
return 403;
}
autoindex off; autoindex off;
location / { if (!-e $request_filename) location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?pagename=$1;}
{
rewrite ^(.*)$ /index.php?pagename=$1;
} }
#deny access to all dot files
location ~ /\. {
deny all;
} }
#Include SSOWAT user panel. #Include SSOWAT user panel.