From d36c34b8ee427883885abf510f1859f2b197c839 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 11 Dec 2021 19:01:58 -0500 Subject: [PATCH] fixes or whatevs --- .../Server Blocks/edu.libraryofcode.org.conf | 72 ++++--------------- .../internships.libraryofcode.org.conf | 30 ++++++++ 2 files changed, 43 insertions(+), 59 deletions(-) create mode 100644 Nginx/Server Blocks/internships.libraryofcode.org.conf diff --git a/Nginx/Server Blocks/edu.libraryofcode.org.conf b/Nginx/Server Blocks/edu.libraryofcode.org.conf index 6ac46aa..7d80d52 100644 --- a/Nginx/Server Blocks/edu.libraryofcode.org.conf +++ b/Nginx/Server Blocks/edu.libraryofcode.org.conf @@ -4,64 +4,18 @@ server { server_name edu.libraryofcode.org; ssl_certificate /etc/nginx/ssl/org.chain.crt; - ssl_certificate_key /etc/nginx/ssl/org.key.pem; + ssl_certificate_key /etc/nginx/ssl/org.key.pem; - location / { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Frame-Options SAMEORIGIN; - proxy_pass http://localhost:7560; - proxy_read_timeout 90; - } + root /opt/moodle; + + index index.html index.htm index.php; + + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_pass /run/php/php8.0-fpm_moodle.sock; + include fastcgi_params; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } } - -server { - listen 443 ssl http2; - listen [::]:443 ssl http2; - server_name studio.libraryofcode.org; - - ssl_certificate /etc/nginx/ssl/org.chain.crt; - ssl_certificate_key /etc/nginx/ssl/org.key.pem; - - client_max_body_size 100M; - - location / { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Frame-Options SAMEORIGIN; - proxy_pass http://localhost:7560; - proxy_read_timeout 90; - } -} - - -#server { -# listen 443 ssl http2; -# listen [::]:443 ssl http2; -# server_name edu.libraryofcode.org; - -# ssl_certificate /etc/nginx/ssl/org.chain.crt; -# ssl_certificate_key /etc/nginx/ssl/org.key.pem; - - -# root /opt/canvas/public; -# charset utf-8; -# include mime.types; -# client_max_body_size 5000M; -# default_type application/octet-stream; -# access_log /var/log/nginx/canvas.access.log; -# error_log /var/log/nginx/canvas.error.log; -# passenger_ruby /usr/local/bin/ruby2.4; -# passenger_load_shell_envvars off; -# passenger_min_instances 8; - #passenger_log_level 4; -# passenger_start_timeout 300; -# passenger_enabled on; - #passenger_pre_start https://edu.libraryofcode.org/; -# rails_env production; -#} - diff --git a/Nginx/Server Blocks/internships.libraryofcode.org.conf b/Nginx/Server Blocks/internships.libraryofcode.org.conf new file mode 100644 index 0000000..abfc5aa --- /dev/null +++ b/Nginx/Server Blocks/internships.libraryofcode.org.conf @@ -0,0 +1,30 @@ +// php7.2-fpm-internships.sock + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name internships.libraryofcode.org; + + ssl_certificate /etc/nginx/ssl/org.chain.crt; + ssl_certificate_key /etc/nginx/ssl/org.key.pem; + + + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_pass /run/php/php7.2-fpm-internships.sock; + include fastcgi_params; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + + # Hide all dot files but allow "Well-Known URIs" as per RFC 5785 + location ~ /\.(?!well-known).* { + return 404; + } + + location ~ (/vendor/|/node_modules/|composer\.json|/readme|/README|readme\.txt|/upgrade\.txt|db/install\.xml|/fixtures/|/behat/|phpunit\.xml|\.lock|environment\.xml) { + deny all; + return 404; + } +}