diff --git a/src/nginxconfig/generators/conf/website.conf.js b/src/nginxconfig/generators/conf/website.conf.js index 8815e5f..04e04dc 100644 --- a/src/nginxconfig/generators/conf/website.conf.js +++ b/src/nginxconfig/generators/conf/website.conf.js @@ -171,7 +171,7 @@ export default (domain, domains, global) => { if (global.tools.modularizedStructure.computed) { // Modularized - locConf.push(['include', 'nginxconfig.io/python_uwsgi.conf']); + locConf.push(['include', 'nginxconfig.io/proxy.conf']); } else { // Unified locConf.push(...Object.entries(proxyConf())); diff --git a/src/nginxconfig/generators/index.js b/src/nginxconfig/generators/index.js index 876ef42..79df762 100644 --- a/src/nginxconfig/generators/index.js +++ b/src/nginxconfig/generators/index.js @@ -4,6 +4,12 @@ import websiteConf from './conf/website.conf'; import letsEncryptConf from './conf/letsencrypt.conf'; import securityConf from './conf/security.conf'; import generalConf from './conf/general.conf'; +import phpConf from './conf/php_fastcgi.conf'; +import pythonConf from './conf/python_uwsgi.conf'; +import proxyConf from './conf/proxy.conf'; +import wordPressConf from './conf/wordpress.conf'; +import drupalConf from './conf/drupal.conf'; +import magentoConf from './conf/magento.conf'; export default (domains, global) => { const files = []; @@ -30,6 +36,31 @@ export default (domains, global) => { // General files.push(['nginxconfig.io/general.conf', toConf(generalConf(domains, global))]); + + // PHP + if (domains.some(d => d.php.php.computed)) + files.push(['nginxconfig.io/php_fastcgi.conf', toConf(phpConf(domains, global))]); + + // Python + if (domains.some(d => d.python.python.computed)) + files.push(['nginxconfig.io/python_uwsgi.conf', toConf(pythonConf(global))]); + + // Reverse proxy + if (domains.some(d => d.reverseProxy.reverseProxy.computed)) + files.push(['nginxconfig.io/proxy.conf', toConf(proxyConf())]); + + // WordPress + if (domains.some(d => d.php.wordPressRules.computed)) + files.push(['nginxconfig.io/wordpress.conf', toConf(wordPressConf(global))]); + + // Drupal + if (domains.some(d => d.php.drupalRules.computed)) + files.push(['nginxconfig.io/drupal.conf', toConf(drupalConf(global))]); + + // Drupal + if (domains.some(d => d.php.magentoRules.computed)) + files.push(['nginxconfig.io/magento.conf', toConf(magentoConf())]); + } return files; diff --git a/src/nginxconfig/generators/to_conf.js b/src/nginxconfig/generators/to_conf.js index bdb3493..f4e0e7b 100644 --- a/src/nginxconfig/generators/to_conf.js +++ b/src/nginxconfig/generators/to_conf.js @@ -75,12 +75,19 @@ const recurse = (entriesOrObject, depth) => { }); } - return retVal - .replace(/\n\n\n/g, '\n\n') // Cleanup triple linebreaks - .replace(/^([^\S\r\n]*})(?:\n[^\S\r\n]*)+\n([^\S\r\n]*})/gm, '$1\n$2') // Cleanup extra linebreaks between multiple close blocks - .replace(/^([^\S\r\n]*[^#\s].*[^\n])\n([^\S\r\n]*)#/gm, '$1\n\n$2#') // Double linebreak before comment - .replace(/^([^\S\r\n]*#.*)(?:\n[^\S\r\n]*)+\n([^\S\r\n]*.*{)/gm, '$1\n$2') // Single linebreak between comment and block - .replace(/^([^\S\r\n]*#.*\n[^\S\r\n]*#.*\n)([^\S\r\n]*[^#\s])/gm, '$1\n$2'); // Double linebreak after double comment + return retVal; }; -export default entriesOrObject => recurse(entriesOrObject, 0); +export default entriesOrObject => recurse(entriesOrObject, 0) + // Cleanup triple linebreaks + .replace(/\n\n\n/g, '\n\n') + // Cleanup extra linebreaks between multiple close blocks + .replace(/^([^\S\r\n]*})(?:\n[^\S\r\n]*)+\n([^\S\r\n]*})/gm, '$1\n$2') + // Double linebreak before comment + .replace(/^([^\S\r\n]*[^#\s].*[^\n])\n([^\S\r\n]*)#/gm, '$1\n\n$2#') + // Single linebreak between comment and block + .replace(/^([^\S\r\n]*#.*)(?:\n[^\S\r\n]*)+\n([^\S\r\n]*.*{)/gm, '$1\n$2') + // Double linebreak after double comment + .replace(/^([^\S\r\n]*#.*\n[^\S\r\n]*#.*\n)([^\S\r\n]*[^#\s])/gm, '$1\n$2') + // Remove initial & trailing whitespace + .trim(); diff --git a/src/nginxconfig/templates/app.vue b/src/nginxconfig/templates/app.vue index 7c0e521..d132316 100644 --- a/src/nginxconfig/templates/app.vue +++ b/src/nginxconfig/templates/app.vue @@ -63,10 +63,14 @@ limitations under the License.

Config files

- +
+
+

{{ nginxDir }}/{{ conf[0] }}

+ +
+