config for user's selection for php server

This commit is contained in:
Aman Agarwal 2022-05-25 19:30:47 +05:30
parent 12ee5ebf02
commit e5d39c5509
3 changed files with 8 additions and 7 deletions

View File

@ -312,7 +312,7 @@ export default (domain, domains, global, ipPortPairs) => {
if (!domain.https.forceHttps.computed && domain.https.certType.computed === 'letsEncrypt')
serverConfig.push(...Object.entries(letsEncryptConf(global)));
if (domain.php.wordPressRules.computed) serverConfig.push(...Object.entries(wordPressConf(global)));
if (domain.php.wordPressRules.computed) serverConfig.push(...Object.entries(wordPressConf(global, domain)));
if (domain.php.drupalRules.computed) serverConfig.push(...Object.entries(drupalConf(global)));
if (domain.php.magentoRules.computed) serverConfig.push(...Object.entries(magentoConf()));
if (domain.php.joomlaRules.computed) serverConfig.push(...Object.entries(joomlaConf()));

View File

@ -24,7 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
export default global => {
export default (global, domain) => {
const config = {};
config['# WordPress: allow TinyMCE'] = '';
@ -60,8 +60,10 @@ export default global => {
config['location = /wp-login.php'] = {
limit_req: 'zone=login burst=2 nodelay',
include: 'nginxconfig.io/php_fastcgi.conf',
fastcgi_pass: 'unix:/run/php/php7.4-fpm.sock',
};
if (domain.php.wordPressRules.computed) {
config['location = /wp-login.php'].fastcgi_pass = 'unix:/run/php/php7.4-fpm.sock';
}
}
// Done!

View File

@ -61,6 +61,9 @@ export default (domains, global) => {
const ipPortPairs = new Set();
for (const domain of domains) {
files[`${sitesDir}/${domain.server.domain.computed}.conf`] = toConf(websiteConf(domain, domains, global, ipPortPairs));
// WordPress
if (domains.some(d => d.php.wordPressRules.computed))
files['nginxconfig.io/wordpress.conf'] = toConf(wordPressConf(global, domain));
}
// Let's encrypt
@ -85,10 +88,6 @@ export default (domains, global) => {
if (domains.some(d => d.reverseProxy.reverseProxy.computed))
files['nginxconfig.io/proxy.conf'] = toConf(proxyConf(global));
// WordPress
if (domains.some(d => d.php.wordPressRules.computed))
files['nginxconfig.io/wordpress.conf'] = toConf(wordPressConf(global));
// Drupal
if (domains.some(d => d.php.drupalRules.computed))
files['nginxconfig.io/drupal.conf'] = toConf(drupalConf(global));