Kloxo apache config template - apache

I'm using Kloxo control panel. And if an account is created through kloxo, It creates a domain config includes virtual host of the created domains and another strings in path :
/home/apache/conf/domains/$domain.conf
My question is :
How can i configure this config template and modify it, I want this modifications to be applied in new create accounts accounts.
Like the ones which exists in cPanel control panel in /var/cpanel/templates/apache2/
Thanks

Kloxo does not use templates for Apache or Lighttpd. You must edit the PHP file which generates vhost configuration files and customize it to your needs.
/usr/local/lxlabs/kloxo/httpdocs/lib/domain/web/driver/web__apachelib.php
Just keep in mind the file will be overwritten everytime you update the panel.

Related

How do you disable "/controlpanel" directory redirect to :2083 in WHM?

I've used WHM and cpanel for years but recently noticed that after an update the "/controlpanel" directory has been automatically added allowing domain.com/controlpanel to redirect to domain.com:2083
How do you disable this redirect that is public facing?
The /controlpanel and /securecontrolpanel are controlled by ScriptAliasMatch in httpd.conf which cannot by modified directly as WHM/cPanel will rebuild it again as it where before the manual modifications. So it will be better if modifications done through one of the following options:
SSH access is needed to apply any one of these
Modify the yaml file which used in the rebuild apache configuration process, the file can be found under /var/cpanel/conf/apache/local or /var/cpanel/conf/apache/main then rebuild apache configuration by running /scripts/rebuildhttpdconf then restart apache by running /usr/local/cpanel/scripts/restartsrv_httpd
Modify the template file which used to parse the previous yaml file in order to generate the configuration file. First copy this file /var/cpanel/templates/apache2_4/ea4_main.default to /var/cpanel/templates/apache2_4/ea4_main.local then start modifying it then rebuild and restart apache.
And my vote goes to the first option to keep it clean and simple as possible but it worth knowing both ways so you can extend the functionality as much as you can.
For more details:
Apache Global Configuration docs
Apache Custom Templates docs

Using same Directory directive for multiple virtual hosts with custom conf files

We have a SaaS product and we give websites for customers. The customers can request to have their own domain pointed to their website. At the moment we use httpd.conf file to add a VirtualHost entry pointing to the same document directory. Afterwards the database will load the website by matching the URL. We have CentOS installed.
I think this is quite risky because if there is a mistake in httpd.conf file their is potential the whole product might not work. This has actually happen. Also, we use WHM and cPanel, so when we add a mod or does a server tweak the entire httpd.conf gets rewritten having us to replace/add existing virtual host entries to the file.
I will need a solution where i can add VirtualHost entries in a separate conf file or multiple conf files and load them via httpd.conf file which should automatically pick the newly added file/files without having to restart the server.
Can someone point me in the right direction where i can achieve the above.
Cheers!
You dont need to restart, just reload

How to exclude subdomain directory from main website

I've setup a VPS with apache2.
I am using cloudflare for DNS management.
Now, I have my websites's files in "var/www/website" folder. Inside that, there is another folder for forum. like "var/www/website/forum" inside which there are all forum related files.
Now, suppose I have www.website.com pointing to "var/www/website"
and I also have a subdomain forum.website.com pointing to "var/www/website/forum".
What I want to do is make the files inside "var/www/website/forum" accessible via subdomain only. I don't want users to access forum via www.website.com/forum, but I want them to access it only via "forum.website.com"
What you need to do is set up what's called a virtual host. You would put your forum at /var/www/forum and website at /var/www/website.
inside /etc/apache2/sites-available, you'll need to add an additional configuration file for that site called forum.website.com.conf.
You'll then need to create a symbolic link to /etc/apache2/sites-enabled for that file so that apache sees it. From there, you reboot the server and are good to go.
Here's some documentation:
http://httpd.apache.org/docs/2.2/vhosts/
http://httpd.apache.org/docs/2.2/vhosts/examples.html
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
This may be a bit different depending on the flavor of linux, but should be about the same. Control panels like Cpanel, Plesk and WebMan can make this process a bit easier by abstracting the configuration to a web control panel.
Hope this helps you.

Create Apache VitualHost for each User

I'm trying to setup a server at www.domain.com that will allow me to create hosting accounts for each user I add.
Basically my goal is to create a user and map a name-based vhost to their home dir, so:
"joe.domain.com" would point to "/home/joe"
I've tried setting up vhosts in httpd.conf but I'm not having any luck and wondering if there's a way to either 1. script this process or 2. setup some sort of variable in a generic vhost entry that will automatically create this entry.
Without knowing the details of your setup, I can tell you that:
Yes, you can script the process.
Apache configuration files are just text files, so it's very easy to generate the programatically.
Yes, you can configure some sort of generic virtual host entry.
The Dynamically configured mass virtual hosting documentation from Apache addresses this case quite nicely.

change default page in cpanel

What do I need to do to change the default page in cpanel?
Update or create .htaccess file in the public_html folder and make the following content..
DirectoryIndex index.php home.php
If you are referring to the default apache cPanel page then you will need whm access for that
WHM >> Main >> Account Functions >> Web Template Editor
Here you can change the default page, suspended page etc.
Assuming you are referring to the default page when an account is created, this is easily done by creating an index.html or .php page within your /etc/skel folder (assuming you have a VPS or dedicated server).
There is a setting within WHM that allows for it in case you are not CLI savvy.
Hope this helps, sorry for the delayed response, but I'm new and trying to build my rep up!
You can create custom branded login pages for cPAnel and WHM by using the advanced branding features of cPanel. cPanel also supports custom login pages for each reseller's accounts. Linked Below is the documentation.
http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/CustomBrandedLoginPages
how to create cpanel default page for hosting domains.
create default html page and upload the files in Skeleton Directory on cpanel root domain.
http://www.motherhost.in/members/knowledgebase/22/how-to-change-default-page-in-cpanel.html
The skeleton directory ( Skeleton Directory: A directory that defines what files and subdirectories new accounts will have by default. When the account is created, the new user’s account will contain an exact copy of the skeleton directory.) exists to let you easily copy the same files into every new account’s public_html and public_ftp directories when the account is created.
Keep in mind that:
When a visitor accesses http://example.com, he will see the contents of example.com 's public_html directory.
When a visitor accesses http://example.com/subdirectory, he will see the contents of public_html/subdirectory.
Contents of the public_ftp directory are available for anonymous FTP users to download.
This WHM feature simply states the location of the skeleton directory (/root/cpanel3-skel).
To set up your skeleton directory:
These files will be accessible to the new user via an FTP client.
Decide what kind of default setup you would like your new users to have.
Place the appropriate subdirectories and HTML files in /root/cpanel3-skel/public_html.
These files will be copied to new accounts’ public_html directories when accounts are created.
Place the appropriate FTP-related files in /root/cpanel3-skel/public_ftp.
These files will be accessible to the new user via an FTP client.