mirror of
				https://github.com/digitalocean/nginxconfig.io.git
				synced 2025-11-04 18:28:17 +08:00 
			
		
		
		
	@@ -53,6 +53,7 @@
 | 
			
		||||
* PHP backup server
 | 
			
		||||
* WordPress security essentials
 | 
			
		||||
* Drupal security essentials
 | 
			
		||||
* Magento security essentials
 | 
			
		||||
 | 
			
		||||
### Routing
 | 
			
		||||
* `index`
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								public/assets/img/brands/magento.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								public/assets/img/brands/magento.svg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Magento icon</title><path d="M12 24l-4.455-2.572v-12l2.97-1.715v12.001l1.485.902 1.485-.902V7.713l2.971 1.715v12L12 24zM22.391 6v12l-2.969 1.714V7.713L12 3.43 4.574 7.713v12.001L1.609 18V6L12 0l10.391 6z"/></svg>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 290 B  | 
@@ -52,6 +52,7 @@
 | 
			
		||||
		php_server_backup:	'',
 | 
			
		||||
		wordpress:			false,
 | 
			
		||||
		drupal:				false,
 | 
			
		||||
		magento:			false,
 | 
			
		||||
 | 
			
		||||
		file_structure:		'modularized',
 | 
			
		||||
		symlink:			true,
 | 
			
		||||
@@ -379,6 +380,7 @@
 | 
			
		||||
			$scope.data.php				= $scope.defaultData.php;
 | 
			
		||||
			$scope.data.wordpress		= $scope.defaultData.wordpress;
 | 
			
		||||
			$scope.data.drupal			= $scope.defaultData.drupal;
 | 
			
		||||
			$scope.data.magento			= $scope.defaultData.magento;
 | 
			
		||||
			$scope.data.proxy			= $scope.defaultData.proxy;
 | 
			
		||||
			$scope.data.index			= $scope.defaultData.index;
 | 
			
		||||
			$scope.data.fallback_html	= $scope.defaultData.fallback_html;
 | 
			
		||||
@@ -402,6 +404,9 @@
 | 
			
		||||
			case 'drupal':
 | 
			
		||||
				$scope.data.drupal = true;
 | 
			
		||||
				break;
 | 
			
		||||
			case 'magento':
 | 
			
		||||
				$scope.data.magento = true;
 | 
			
		||||
				break;
 | 
			
		||||
			case 'nodejs':
 | 
			
		||||
				$scope.data.php = false;
 | 
			
		||||
				$scope.data.proxy = true;
 | 
			
		||||
@@ -538,6 +543,10 @@
 | 
			
		||||
			return $scope.isPHP() && $scope.data.drupal;
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		$scope.isMagento = function() {
 | 
			
		||||
			return $scope.isPHP() && $scope.data.magento;
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		$scope.isCSP = function() {
 | 
			
		||||
			return !!$scope.data.content_security_policy;
 | 
			
		||||
		};
 | 
			
		||||
 
 | 
			
		||||
@@ -8,9 +8,9 @@
 | 
			
		||||
		<link rel="icon" type="image/png" href="assets/img/favicon.png">
 | 
			
		||||
		<title>nginxconfig.io</title>
 | 
			
		||||
		<meta name="description" content="NGiИX configuration generator">
 | 
			
		||||
		<meta name="keywords" content="nginx, config, configurator, /etc/nginx/nginx.conf, nginx performance, nginx tuning, nginx php, nginx, php fpm, wordpress, drupal, Let's Encrypt, custom certificate, cdn, access_log, error_log, Laravel, Lumen, Symfony, Zend, CodeIgniter, Yii, CakePHP, Slim, Angular, React, Vue.js, Ember.js, reverse proxy, Node.js">
 | 
			
		||||
		<meta name="keywords" content="nginx, config, configurator, /etc/nginx/nginx.conf, nginx performance, nginx tuning, nginx php, nginx, php fpm, wordpress, drupal, magento, Let's Encrypt, custom certificate, cdn, access_log, error_log, Laravel, Lumen, Symfony, Zend, CodeIgniter, Yii, CakePHP, Slim, Angular, React, Vue.js, Ember.js, reverse proxy, Node.js">
 | 
			
		||||
		<meta property="og:title" content="nginxconfig.io">
 | 
			
		||||
		<meta property="og:description" content="NGiИX configuration generator: HTTPS, HTTP2, CDN, PHP, HHVM, Frontend, Reverse proxy, Node.js, WordPress, Drupal, security headers, rate limiting, expiration by file types…">
 | 
			
		||||
		<meta property="og:description" content="NGiИX configuration generator: HTTPS, HTTP2, CDN, PHP, HHVM, Frontend, Reverse proxy, Node.js, WordPress, Drupal, Magento, security headers, rate limiting, expiration by file types…">
 | 
			
		||||
		<meta property="og:type" content="website">
 | 
			
		||||
		<meta property="og:url" content="https://nginxconfig.io">
 | 
			
		||||
		<meta property="og:image" content="https://nginxconfig.io/assets/img/share.png">
 | 
			
		||||
@@ -29,6 +29,7 @@
 | 
			
		||||
				<button type="button" class="btn btn-sm btn-outline-dark" ng-click="setPreset('spa')" tooltips tooltip-template="• enabled PHP<br>• index.html fallback routing<br>• index.php API routing" tooltip-side="bottom">Single-page application</button>
 | 
			
		||||
				<button type="button" class="btn btn-sm btn-outline-dark" ng-click="setPreset('wordpress')" tooltips tooltip-template="• enabled PHP<br>• index.php fallback routing<br>• WordPress security rules" tooltip-side="bottom"><img src="assets/img/brands/wordpress.svg" alt="WordPress"> WordPress</button>
 | 
			
		||||
				<button type="button" class="btn btn-sm btn-outline-dark" ng-click="setPreset('drupal')" tooltips tooltip-template="• enabled PHP<br>• index.php fallback routing<br>• Drupal security rules" tooltip-side="bottom"><img src="assets/img/brands/drupal.svg" alt="Drupal"> Drupal</button>
 | 
			
		||||
				<button type="button" class="btn btn-sm btn-outline-dark" ng-click="setPreset('magento')" tooltips tooltip-template="• enabled PHP<br>• index.php fallback routing<br>• Magento security rules" tooltip-side="bottom"><img src="assets/img/brands/magento.svg" alt="Magento"> Magento</button>
 | 
			
		||||
			</div>
 | 
			
		||||
		</section>
 | 
			
		||||
		<section class="tabs">
 | 
			
		||||
@@ -442,6 +443,17 @@
 | 
			
		||||
										</div>
 | 
			
		||||
									</div>
 | 
			
		||||
								</div>
 | 
			
		||||
								<div class="form-group row" ng-if="isPHP()">
 | 
			
		||||
									<label class="col-sm-3 col-form-label col-form-label-sm">
 | 
			
		||||
											<span tooltips tooltip-template="Magento security rules.">Magento rules</span>
 | 
			
		||||
									</label>
 | 
			
		||||
									<div class="col-sm-9">
 | 
			
		||||
										<div class="form-check" ng-class="{ 'input-changed': data.magento !== defaultData.magento }">
 | 
			
		||||
											<input class="form-check-input" type="checkbox" id="magento" ng-model="data.magento">
 | 
			
		||||
											<label class="form-check-label" for="magento">enabled</label>
 | 
			
		||||
										</div>
 | 
			
		||||
									</div>
 | 
			
		||||
								</div>
 | 
			
		||||
							</div>
 | 
			
		||||
							<div class="tab-pane tab-routing" ng-class="{ 'active': tab === 'routing' }">
 | 
			
		||||
								<fieldset class="form-group" ng-if="isPHP()">
 | 
			
		||||
@@ -853,6 +865,16 @@
 | 
			
		||||
							<pre><code class="nginx" ng-include="'templates/conf/nginxconfig.io/drupal.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></code></pre>
 | 
			
		||||
						</div><div id="file-drupal" class="code highlighted"></div>
 | 
			
		||||
					</section>
 | 
			
		||||
					<section class="col-xl-6 grid-item file" ng-if="isMagento() && isModularized()" ng-cloak>
 | 
			
		||||
						<strong>/etc/nginx/nginxconfig.io/magento.conf</strong>
 | 
			
		||||
						<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-magento" ngclipboard-success="clipboardSuccess('magento.conf')">
 | 
			
		||||
							<img src="assets/img/clipboard-dark.svg" alt="Copy to clipboard">
 | 
			
		||||
						</button>
 | 
			
		||||
						<span class="clipboard-success" ng-if="clipboardCopy === 'magento.conf'">Copied!</span>
 | 
			
		||||
						<div class="code source" data-filename="nginxconfig.io/magento.conf">
 | 
			
		||||
							<pre><code class="nginx" ng-include="'templates/conf/nginxconfig.io/magento.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></code></pre>
 | 
			
		||||
						</div><div id="file-magento" class="code highlighted"></div>
 | 
			
		||||
					</section>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		</main>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										82
									
								
								public/templates/conf/nginxconfig.io/magento.conf.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								public/templates/conf/nginxconfig.io/magento.conf.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
			
		||||
# Magento: setup
 | 
			
		||||
location ^~ /setup {
 | 
			
		||||
	root $base;
 | 
			
		||||
 | 
			
		||||
	# allow index.php
 | 
			
		||||
	location ~ ^/setup/index.php {
 | 
			
		||||
		include nginxconfig.io/php_fastcgi.conf;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	# deny everything except pub
 | 
			
		||||
	location ~ ^/setup/(?!pub/). {
 | 
			
		||||
		deny all;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Magento: update
 | 
			
		||||
location ^~ /update {
 | 
			
		||||
	root $base;
 | 
			
		||||
 | 
			
		||||
	# allow index.php
 | 
			
		||||
	location ~ ^/update/index.php {
 | 
			
		||||
		include nginxconfig.io/php_fastcgi.conf;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	# deny everything except pub
 | 
			
		||||
	location ~ ^/update/(?!pub/). {
 | 
			
		||||
		deny all;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Magento: media files
 | 
			
		||||
location ^~ /media/ {
 | 
			
		||||
	try_files $uri $uri/ /get.php?$args;
 | 
			
		||||
 | 
			
		||||
	location ~* \.(?:ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
 | 
			
		||||
		expires +1y;
 | 
			
		||||
		add_header Cache-Control "public";
 | 
			
		||||
		try_files $uri $uri/ /get.php?$args;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	location ~* \.(?:zip|gz|gzip|bz2|csv|xml)$ {
 | 
			
		||||
		expires off;
 | 
			
		||||
		add_header Cache-Control "no-store";
 | 
			
		||||
		try_files $uri $uri/ /get.php?$args;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	location ~ ^/media/theme_customization/.*\.xml {
 | 
			
		||||
		deny all;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	location ~ ^/media/(?:customer|downloadable|import)/ {
 | 
			
		||||
		deny all;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Magento: static route
 | 
			
		||||
location @magento_static {
 | 
			
		||||
	rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Magento: static files
 | 
			
		||||
location ^~ /static/ {
 | 
			
		||||
	expires max;
 | 
			
		||||
	try_files $uri $uri/ @magento_static;
 | 
			
		||||
 | 
			
		||||
	location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
 | 
			
		||||
		expires +1y;
 | 
			
		||||
		add_header Cache-Control "public";
 | 
			
		||||
		try_files $uri $uri/ @magento_static;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
 | 
			
		||||
		expires off;
 | 
			
		||||
		add_header Cache-Control "no-store";
 | 
			
		||||
		try_files $uri $uri/ @magento_static;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Magento: deny cron
 | 
			
		||||
location ~ cron\.php {
 | 
			
		||||
	deny all;
 | 
			
		||||
}
 | 
			
		||||
@@ -98,6 +98,9 @@ server {<!--
 | 
			
		||||
	✔ modularized && ✔ Drupal --><span ng-if="isModularized() && isDrupal()">
 | 
			
		||||
	include nginxconfig.io/drupal.conf;</span><!--
 | 
			
		||||
 | 
			
		||||
	✔ modularized && ✔ Magento --><span ng-if="isModularized() && isMagento()">
 | 
			
		||||
	include nginxconfig.io/magento.conf;</span><!--
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	✔ unified --><span ng-if="isUnified()">
 | 
			
		||||
@@ -110,7 +113,11 @@ server {<!--
 | 
			
		||||
 | 
			
		||||
	✔ unified && ✔ Drupal --><span ng-if="isUnified() && isDrupal()">
 | 
			
		||||
 | 
			
		||||
<!-- --><ng-include ng-include-tabs="2" src="'templates/conf/nginxconfig.io/drupal.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span>
 | 
			
		||||
<!-- --><ng-include ng-include-tabs="2" src="'templates/conf/nginxconfig.io/drupal.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span><!--
 | 
			
		||||
 | 
			
		||||
	✔ unified && ✔ Magento --><span ng-if="isUnified() && isMagento()">
 | 
			
		||||
 | 
			
		||||
<!-- --><ng-include ng-include-tabs="2" src="'templates/conf/nginxconfig.io/magento.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span>
 | 
			
		||||
}<!--
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user