server { listen 80; server_name espocrm.stratinfotech.com; root /opt/espocrm; index index.php index.html index.htm; client_max_body_size 50M; # Specify your PHP (php-cgi or php-fpm) based on your configuration location ~ \.php$ { # try_files $uri = 404; include /etc/nginx/fastcgi.conf; fastcgi_index index.php; # With php7.0-fpm: fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; } # Add rewrite rules location / { try_files $uri $uri/ =404; } location /api/v1/ { if (!-e $request_filename){ rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break; } } location ~ /reset/?$ { try_files /reset.html =404; } location ^~ (data|api)/ { if (-e $request_filename){ return 403; } } location ^~ /data/logs/ { deny all; } location ^~ /data/\.backup/ { deny all; } location ^~ /data/config.php { deny all; } location ^~ /data/cache/ { deny all; } location ^~ /data/upload/ { deny all; } location ^~ /application/ { deny all; } location ^~ /custom/ { deny all; } location ^~ /vendor/ { deny all; } location ~ /\.ht { deny all; } }