Custom HTTP Ttemplates for users

nservices

Verified User
Joined
Dec 11, 2008
Messages
300
Hi,
it's will be grate to add the option let users select template for custom httpd conf
it's can be used for:
1. Nginx custom templates (Magento, Wordpress, Joomla, Drupal, etc...)
2. Display errors and other php / logs and custom settings that we can give users to work with from user level (template selection per domain) without the option to Make something problematic in terms of security or functionality.

Yours sincerely,
Shalom Burla
Star Network and Promotion LTD
 
Example templates usage

Template 1 - Display errors:
php_admin_flag display_errors ON

Template 2 - Wildcard domain for catch all subdomains / site network:
ServerAlias *.|DOMAIN|

Template 3 - Alias domain with emails and all other options:
|?DOCROOT=/home/username/domains/main-account-domain.tld/public_html|

* this allow user to point additional domain to the main domain but as "standard" additional domain, this allow to create and manage ftp / emails / dns settings for this additional domain

Template 4 - Nginx WP:
Code:
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
	try_files $uri $uri/ /index.php?$args;
}

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
       access_log off; log_not_found off; expires max;
}

# Uncomment one of the lines below for the appropriate caching plugin (if used).
#include global/wordpress-wp-super-cache.conf;
#include global/wordpress-w3-total-cache.conf;

# Global restrictions configuration file.
# Designed to be included in any server {} block.</p>
location = /favicon.ico {
	log_not_found off;
	access_log off;
}

location = /robots.txt {
	allow all;
	log_not_found off;
	access_log off;
}

# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
	deny all;
}

# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~* /(?:uploads|files)/.*\.php$ {
	deny all;
}

Template 5 - Nginx template for Magento:
Code:
        location / {
            index index.html index.php; ## Allow a static html file to be shown first
            try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
            expires 30d; ## Assume all files are cachable
        }
     
        ## These locations would be hidden by .htaccess normally
        location ^~ /app/                { deny all; }
        location ^~ /includes/           { deny all; }
        location ^~ /lib/                { deny all; }
        location ^~ /media/downloadable/ { deny all; }
        location ^~ /pkginfo/            { deny all; }
        location ^~ /report/config.xml   { deny all; }
        location ^~ /var/                { deny all; }
     
        location /var/export/ { ## Allow admins only to view export folder
            auth_basic           "Restricted"; ## Message shown in login window
            auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
            autoindex            on;
        }
     
        location  /. { ## Disable .htaccess and other hidden files
            return 404;
        }
     
        location @handler { ## Magento uses a common front handler
            rewrite / /index.php;
        }
     
        location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
            rewrite ^(.*.php)/ $1 last;
        }

Best Regards,
Star Network.
 
user should not be able to edit / change the template but just select one and use it per Needs
display errors / point to main public_html
or select platform template for Nginx.
so it's should be secured.

Best Regards,
Star Network.
 
Great idea, and at some level you can create that.

use the custom templates to create all the templates (above) in separated files - or maybe directly in /usr/local/directadmin/custombuild/custom/nginx so they get copied to /etc/nginx whenever you do:
Code:
./build rewrite_confs
then use the old Custom HTTPD Configuration to include that template for each domain.

later on, you can create a DA plugin for this selector.
 
Hi,
am looking for user level solution without admin Involvement

Best Regards,
Star Network.
 
Back
Top