Last active
October 11, 2021 18:01
-
-
Save luxwarp/ce87ca9871a1de1e06b44cf2c4bfc41a to your computer and use it in GitHub Desktop.
A typical Nginx server block for Cockpit CMS https://github.com/agentejo/cockpit
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
# A typical Nginx server block for Cockpit CMS https://github.com/agentejo/cockpit | |
# Author: Mikael Luxwarp Carlsson luxwarp@codeiolo.org https://codeiolo.org | |
# License: ISC | |
# Created: 2019-08-18 | |
server { | |
# Port to listen to. | |
listen 80; | |
listen [::]:80; | |
# URL to listen to | |
server_name example.com; | |
# Web root of cockpit cms. | |
root /path/to/cockpit; | |
# index file to run. | |
index index.php; | |
# How to handle url | |
location / { | |
try_files $uri $uri/ /index.php; | |
} | |
# Where nginx should write log files. | |
access_log /var/log/nginx/exampe.com.access.log; | |
error_log /var/log/nginx/example.com.error.log; | |
# Deny direct access to .sqlite | |
location ~ .sqlite$ { | |
deny all; | |
} | |
# How nginx should handle php files. | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param COCKPIT_URL_REWRITE On; | |
fastcgi_intercept_errors off; | |
fastcgi_buffer_size 16k; | |
fastcgi_buffers 4 16k; | |
} | |
# Deny direct access to .htaccess files | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment