summaryrefslogtreecommitdiffstats
path: root/srvs
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-02-06 02:40:27 -0500
committerMalf Furious <m@lfurio.us>2018-02-06 02:40:27 -0500
commit5b50f0490b6f177cfabc5646c1786d1140598507 (patch)
tree9047db7101647ca114121c21e538488879c04fb3 /srvs
parentb8351dc9d172b8b00479066dab56c97874ad501c (diff)
downloadscrott-5b50f0490b6f177cfabc5646c1786d1140598507.tar.gz
scrott-5b50f0490b6f177cfabc5646c1786d1140598507.zip
Add sample nginx configuration
I've recently been fighting my dev server to actually work with PHP. It seems like everytime I hop a system, or install nginx from scratch, something in my config is broken. So, I'm finally committing a 'working' (TM) baseline config to work off of when working with servers in the future. The idea is to add an Apache one at some point, too.
Diffstat (limited to 'srvs')
-rw-r--r--srvs/nginx.conf81
1 files changed, 81 insertions, 0 deletions
diff --git a/srvs/nginx.conf b/srvs/nginx.conf
new file mode 100644
index 0000000..a5e81f1
--- /dev/null
+++ b/srvs/nginx.conf
@@ -0,0 +1,81 @@
+##
+# SCROTT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+# For more information, please refer to UNLICENSE
+##
+
+##
+# This file is for configuring NGINX to work with Scrott. This is not
+# a complete configuration, just a simple and genaric server {} block
+# to use as a starting-point for setting up your server.
+##
+
+server
+{
+ listen 80;
+ listen [::]:80 ipv6only=on;
+ listen 443 ssl;
+ listen [::]:443 ssl ipv6only=on;
+
+ # set to your instance #
+ server_name localhost;
+ root /usr/share/nginx/scrott;
+
+ index index.php;
+ keepalive_timeout 70;
+
+ ##
+ # Completely deny access to user-supplied content. This content
+ # should instead be served by the df.php script, to enforce
+ # access permissions and prevent code-execution.
+ ##
+ location ^~ /dynmic
+ {
+ deny all;
+ return 404;
+ }
+
+ ##
+ # Allow direct access to built-in static content, instead of
+ # passing these requests to the PHP system.
+ ##
+ location ^~ /static
+ {
+ try_files $uri $uri/ =404;
+ }
+
+ ##
+ # Process normal requests via (clean) url rewriting. Unless
+ # the requested path exists on disk, pass it to index.php
+ # for processing.
+ ##
+ location /
+ {
+ rewrite ^(.*)$ /index.php$1;
+ }
+
+ ##
+ # Hand-off completed php rewrites (or direct requests) to
+ # php-fpm for processing.
+ ##
+ location ~ [^/]\.php(/|$)
+ {
+ fastcgi_split_path_info ^((?U).+\.php)(.*)$;
+
+ try_files $fastcgi_script_name =404;
+
+ include fastcgi_params;
+ set $path_info $fastcgi_path_info;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param PATH_INFO $path_info;
+
+ fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
+ fastcgi_index index.php;
+ }
+}