2021-07-08 22:58:44 -04:00
|
|
|
server {
|
|
|
|
listen 443 ssl http2;
|
|
|
|
listen [::]:443 ssl http2;
|
|
|
|
server_name journal.libraryofcode.org;
|
|
|
|
|
|
|
|
root /var/www/ojs;
|
|
|
|
|
|
|
|
ssl_certificate /etc/nginx/ssl/org.chain.crt;
|
|
|
|
ssl_certificate_key /etc/nginx/ssl/org.key.pem;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-07-08 23:55:22 -04:00
|
|
|
# Remove index.php$
|
|
|
|
if ($request_uri ~* "^(.*/)index\.php$") {
|
|
|
|
return 301 $1;
|
|
|
|
}
|
|
|
|
|
2021-07-08 22:58:44 -04:00
|
|
|
location / {
|
2021-07-08 23:55:22 -04:00
|
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
|
|
|
|
|
|
# Remove from everywhere index.php
|
|
|
|
if ($request_uri ~* "^(.*/)index\.php(/?)(.*)") {
|
|
|
|
return 301 $1$3;
|
|
|
|
}
|
2021-07-08 22:58:44 -04:00
|
|
|
}
|
2021-07-08 23:55:22 -04:00
|
|
|
# Remove trailing slash.
|
|
|
|
if (!-d $request_filename) {
|
|
|
|
rewrite ^/(.+)/$ /$1 permanent;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Clean Double Slashes
|
|
|
|
if ($request_uri ~* "\/\/") {
|
|
|
|
rewrite ^/(.*) /$1 permanent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-08 22:58:44 -04:00
|
|
|
error_page 404 /index.php;
|
|
|
|
|
|
|
|
location ~ ^(.+\.php)(.*)$ {
|
|
|
|
set $path_info $fastcgi_path_info;
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
|
|
|
fastcgi_param PATH_INFO $path_info;
|
|
|
|
fastcgi_param PATH_TRANSLATED $document_root$path_info;
|
2021-07-08 23:21:58 -04:00
|
|
|
|
|
|
|
if (!-f $document_root$fastcgi_script_name) {
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
include fastcgi_params;
|
|
|
|
|
2021-07-08 23:15:23 -04:00
|
|
|
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
2021-07-08 22:58:44 -04:00
|
|
|
fastcgi_index index.php;
|
2021-07-08 23:21:58 -04:00
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
2021-07-08 22:58:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
location ~ /\.(?!well-known).* {
|
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
}
|