diff --git a/CHANGELOG.md b/CHANGELOG.md index 5558b61..436e2dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Nginx-Craft Changelog +## 1.0.11 - 2017.10.02 +### Added +* Added a `basic_localdev.com.conf` for people who just want a basic Nginx configuration for Craft local dev + ## 1.0.10 - 2017.09.12 ### Changed * Updated the config to use php7.1 by default diff --git a/README.md b/README.md index 1e32cdc..acbfadc 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,14 @@ If you're using Forge, understand that `opcache` is off by default. To enable it More about tweaking `opcache` can be found in the [Fine-Tune Your Opcache Configuration to Avoid Caching Suprises](https://tideways.io/profiler/blog/fine-tune-your-opcache-configuration-to-avoid-caching-suprises) article. The [Best Zend OpCache Settings/Tuning/Config](https://www.scalingphpbook.com/blog/2014/02/14/best-zend-opcache-settings.html) article is very useful as well. +## Local Development + +While all of the configuration in the `somedomain.com.conf` will work fine in local development as well, some people might want a simpler setup for local development. + +There is a `basic_localdev.com.conf` that you can use for a basic Nginx configuration that will work with Craft without any of the bells, whistles, or optimizations found in the `somedomain.com.conf`. + +While this is suitable for getting up and running quickly for local development, do not use it in production. There are a number of performance optimizations missing from it. + ## Miscellanea If you encounter a problem where large asset uploads fail, despite `memory_limit`, `post_max_size` and `upload_max_filesize` being set properly in your `php.ini`, you may need to add the following to the `http {}` block of the main `nginx.conf`: diff --git a/sites-available/basic_localdev.com.conf b/sites-available/basic_localdev.com.conf new file mode 100644 index 0000000..4388ec5 --- /dev/null +++ b/sites-available/basic_localdev.com.conf @@ -0,0 +1,65 @@ +# Nginx-Craft virtual host configuration file +# @author nystudio107 +# @copyright Copyright (c) 2016 nystudio107 +# @link https://nystudio107.com/ +# @package nginx-craft +# @since 1.0.11 +# @license MIT + +# This is a BASIC Nginx config for Craft, suitable for use in for local development +# DO NOT use this config in production, it is not performant. Instead, use the +# somedomain.com.conf config +server { + # Listen for both IPv4 & IPv6 on port 80 + listen 80; + listen [::]:80; + + # General virtual host settings + server_name SOMEDOMAIN.com; + root "/var/www/SOMEDOMAIN/public"; + index index.html index.htm index.php; + charset utf-8; + + # 404 error handler + error_page 404 /index.php?$query_string; + + # Access and error logging + access_log off; + error_log /var/log/nginx/SOMEDOMAIN.com-error.log error; + # If you want error logging to go to SYSLOG (for services like Papertrailapp.com), uncomment the following: + #error_log syslog:server=unix:/dev/log,facility=local7,tag=nginx,severity=error; + + # Root directory location handler + location / { + try_files $uri/index.html $uri $uri/ /index.php?$query_string; + } + + # php-fpm configuration + location ~ [^/]\.php(/|$) { + try_files $uri $uri/ /index.php?$query_string; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # Change this to whatever version of php you are using + fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param HTTP_PROXY ""; + + fastcgi_intercept_errors off; + fastcgi_buffer_size 16k; + fastcgi_buffers 4 16k; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + } + + # Disable reading of Apache .htaccess files + location ~ /\.ht { + deny all; + } + + # Misc settings + sendfile off; + client_max_body_size 100m; +} \ No newline at end of file