Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Administrator

Pages: 1 2 3 [4] 5
46
PHP / PHP Version Switcher
« on: May 24, 2014, 09:38:32 PM »
Now CWP has PHP Switch option in which you can very easily switch to other PHP version and recompile it with desired modules.

How to use it?
- Click on PHP Version Switcher (here you will get server PHP version and compiled modules which your server has now compiled).
- Select PHP Version you wish to compile in drop-down menu and click next.
- In PHP compiler you can add or remove modules you want (please use only: one per line).
- Click on Start compiler and compiler will start to work in background.

Compiler needs from 5 to 20 minutes to finish depending on modules you are installing and your CPU power.
You can return in eg. 15 minutes and in CWP - PHP Version Switch check which version of PHP and modules you now have.

Your websites and CWP will work during compiler process and PHP will be update when compiler is completed and only if its successful.

You can check PHP compile logs in file:
Code: [Select]
/var/log/php-rebuild.log
If you wish to monitor compiler then use this command from shell:
Code: [Select]
tail -f /var/log/php-rebuild.log




47
Backup / Remote Disk Backup SSHFS
« on: May 24, 2014, 09:10:08 PM »
CWP now is now providing you possibility to mount remote disk from any server to your server as local using fuse-sshfs.

How this works?
If you have any access to ssh on some other server you can mount that disk space as folder on your server, this is mostly used for backups in local networks.

Disk Details are looking like this:
Code: [Select]
[root@rec2 /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/simfs            180G  2.3G  178G   2% /
none                  2.0G  4.0K  2.0G   1% /dev
none                  2.0G     0  2.0G   0% /dev/shm
cwptest@backup.cwp.org:
                      1.8T  1.8T     0 100% /backup

Requirements
- Server with CWP and allowed FUSE (on openVZ in most cases this option is not allowed, except eg. on http://mybestwebhosting.net/ which allow it on user request).
    **On dedicated and other Virtualization types you can install all required with one click in you CWP
- SSH Access on the remote server (which you want to use for mount as folder on your server)



How to Setup Remote Disk and use it for backups?
1. In your CWP under backups set backup folder
2. Make sure that backup folder is empty
3. Install required packages (one click in CWP)
4. Click on Generate Key (this will generate ssh key)
4a. Setup SSH Key on remote server --> more info is bellow this tutorial.
5. Enter remote Backup details (server ip or domain, SSH username, SSH Port) and click on Save Configuration
6. Click on Test Connection (if connection works than you can mount disk)
7. Click mount Disk
that is it...



4a. Setup SSH KEY on Remote/Backup server (NOT ON YOUR CWP SERVER)
cd ~USERNAME
mkdir .ssh
chmod 700 .ssh
nano or vi to file and add key from CWP under backup (must be in one line):   .ssh/authorized_keys
chmod 600  .ssh/authorized_keys
chown -R USERNAME:USERNAME .ssh



How to check for errors from command line?
sshfs USERNAME@SERVER-IP: LOCAL--BACKUP-FOLDER -p REMOTE-SSH-PORT

examples:
sshfs cwp@backup.cwp.org: /backup -p 22
sshfs root@185.4.192.11: /backup -p 8407

48
New Modules / How to Build a new module for CentOS Web Panel (CWP)
« on: May 23, 2014, 09:20:00 AM »
How to Build a new module for CentOS Web Panel (CWP)??

Itís very easy to build new module for CentOS-WebPanel

Letís create file named: test2.php
Code: [Select]
<?php

$cpu_info 
shell_exec("cat /proc/cpuinfo");
echo 
"This is example module<br>";
echo 
"You can edit this file and make new modules based on this file<br>";
echo 
"Examples and functions are on our website: centos-webpanel.com<br>";
echo 
"<h3>CPU INFO</h3>";
echo 
"<pre>".$cpu_info."</pre>";

?>


to open this file in CentOS-WebPanel upload it to modules folder and use this link path:

Code: [Select]
http://SERVER_IP:2030/index.php?module=FILE_NAME
eg. http://123.123.123.123:2030/index.php?module=test2

How to add this module to CentOS-WebPanel menu?
Itís easy, go to include folder and make new file named 3rdparty.php ,in this file you add links one per line.
eg.

/usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php
Code: [Select]
<li><a href="index.php?module=test2"><span class="icon16 icomoon-icon-arrow-right-3"></span>Test2 Module</a></li>
<li><a href="index.php?module=test3"><span class="icon16 icomoon-icon-arrow-right-3"></span>Test3 Module</a></li>

All useful modules will be added in CWP installation or additional module installation panel.

Admin panel modules location
/usr/local/cwpsrv/htdocs/resources/admin/modules

Client panel modules location
/usr/local/cwpsrv/htdocs/resources/client/modules

Example module developed by the 3rdParty
https://github.com/boxbillinggit/cwp_modules/blob/master/php_phalcon.php

49
Varnish / How to install varnish cache on centos [CWP]
« on: May 18, 2014, 11:30:07 PM »
This is very simple tutorial how to use and install Varnish Cache Server on CentOS using CWP panel.

1. In your CWP menu find Varnish
2. Click on install
3. Setup Config

Default config to use/enable Varnish Cache Server is:
Code: [Select]
Apache IP: (Your Shared IP, or 127.0.0.1)
Apache port: 82
Varnish IP: (default all, if you need to change than edit config files  manually)
Varnish Port: 80
If you are getting default CWP page on your domain index then you can try setting your shared ip to 127.0.0.1


How to check if Varnish Cache Server Works?
- Using CURL command  "curl -i SERVER-IP" you will get headers and on beginning of the output try finding "X-Varnish"
- Using this website "http://www.whatismyip.com/server-headers-check/" in Response find "X-Varnish"




Default config to disable Varnish Cache and use Apache only is:
Code: [Select]
Apache IP: (Your Shared IP)
Apache port: 80
Varnish IP: (default all, if you need to change than edit config files  manually)
Varnish Port: 6081

50
MySQL / Warning: mysql_connect(): No such file or directory
« on: May 16, 2014, 07:25:58 PM »
If you get this error then you will need to find your mysql.sock location, try searching your mysql.sock location with this command:

Code: [Select]
find / -name mysql.sock
default location fix (if location is: /var/lib/mysql/mysql.sock):
Code: [Select]
/bin/ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
default location fix (if location is: /var/mysql/mysql.sock):
Code: [Select]
ln -s /var/mysql/mysql.sock /tmp/mysql.sock

51
If you get this error message while restarting apache:
Code: [Select]
Starting httpd: [warn] _default_ VirtualHost overlap on port 80, the first has precedence
You can edit and set: /etc/httpd/conf/httpd.conf  NameVirtualHost to:
Code: [Select]
NameVirtualHost *:80
This fix will resolve an issue (if any) with all domains opening same website.


Sample configuration:
Code: [Select]
# My Virtual Hosts Config File for Two Domains
NameVirtualHost *:80
 
<VirtualHost *:80>
    ServerAdmin webmaster@theos.in
    DocumentRoot "/usr/local/docs/theos.in"
    ServerName www.theos.in
    ServerAlias theos.in
    ErrorLog "/var/log/theos.in-error_log"
    CustomLog "/var/log/theos.in-access_log" common
</VirtualHost>
 
<VirtualHost *:80>
    ServerAdmin webmaster@nixcraft.com
    DocumentRoot "/usr/local/docs/nixcraft.com"
    ServerName www.nixcraft.com
    ServerAlias nixcraft.com
    ErrorLog "/var/log/nixcraft.com-error_log"
    CustomLog "/var/log/nixcraft.com-access_log" common
</VirtualHost>

52
If you use mod rewrite and .htaccess for your website than you will need to add this in your vhost file (change USERNAME)

you need to edit where your domain is listed in file:
Code: [Select]
/etc/httpd/conf/httpd_webpanel_vhosts.conf
Add this:
Code: [Select]
<Directory "/home/USERNAME/public_html">
AllowOverride All
</Directory>

add this config beffore </VirtualHost> for your domain

53
If you get this error listed bellow:
Code: [Select]
date(): It is not safe to rely on the system's timezone settings
mktime(): It is not safe to rely on the system's timezone settings

You can edit your /etc/php.ini file and search:
Code: [Select]
date.timezone =
You can edit it eg. like this:
Code: [Select]
date.timezone ="US/Central"
After editing you can restart apache:
Code: [Select]
service httpd restart
Time Zone list:
https://php.net/manual/en/timezones.php

54
E-Mail / Postfix Mail Server commands
« on: March 27, 2014, 10:12:09 PM »
Some useful postfix commands
postqueue -p = mailq    //postqueue -p is the same as mailq

service postfix reload    //reload config
service postfix restart   //restart postfix server

postconf  mail_version      //View the postfix version
postconf -d     //Show default postfix values
postconf -n     //Show non default postfix values

mailq     //list mail queue and MAIL_ID's, list mail queue
postqueue -p //list mail queue and MAIL_ID's, list mail queue
postfix  flush   // flush mail queue
postqueue -f    //process the queue now
postcat -q MAIL_ID     //read email from mail queue

postsuper -d MAIL_ID       //To remove MAIL_ID mail from the queue
postsuper -d ALL       //To remove all mail from the queue
postsuper -d ALL deferred        //To remove all mails in the deferred queue

postqueue -p | awk '/^[0-9,A-F]/ {print $7}' | sort | uniq -c | sort -n           //sort and count emails by "from address"

postqueue -p | grep '^[A-Z0-9]'|grep user@adminlogs.info|cut -f1 -d' ' |tr -d \*|postsuper -d -          //removing all emails sent by: user@adminlogs.info

postqueue -p | awk '/^[0-9,A-F].*user@adminlogs.info / {print $1}' | cut -d '!' -f 1 | postsuper -d -      //remove all email sent from user@adminlogs.info

To delete all messages from the queue by a certain user:
for i in `postqueue -p | grep user@domain.com | awk '{print $1}' | grep -v host | grep -v \*`; do postsuper -d $i; done

postqueue -p | grep '^[A-Z0-9]'|grep @adminlogs.info|cut -f1 -d' ' |tr -d \*|postsuper -d -      //remove all email sent by domain adminlogs.info


postqueue -p | tail -n 1   //Mail queue stats short
postqueue -p | grep -c "^[A-Z0-9]"    //number of emails in Mail queue

tail -f /var/log/maillog    //watch logs live

55
Mod_Security / How to install Mod_Security to secure Apache
« on: February 01, 2014, 01:55:03 AM »
This tutorial is only for the CWP version 0.1 to 0.7, in the newer version you can install it with one click from the panel
=======================================================================

ModSecurity operates embedded into the web server (httpd/apache), acting as a powerful IPS - shielding web applications from attacks

If you have CWP installed than you can install Mod Security and rules with one click from Security menu in CWP.

Install Mod_Security
Code: [Select]
yum install mod_security git
cd /etc/httpd/
git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git
mv owasp-modsecurity-crs modsecurity-crs
cd modsecurity-crs
cp modsecurity_crs_10_setup.conf.example modsecurity_crs_10_config.conf

Now add config to end of file: /etc/httpd/conf/httpd.conf
Code: [Select]
<IfModule security2_module>
    Include modsecurity-crs/modsecurity_crs_10_config.conf
    Include modsecurity-crs/base_rules/*.conf
</IfModule>


That is it, do not forget to restart server
Code: [Select]
service httpd restart
Check logs if mod_security works
Code: [Select]
/var/log/httpd/error_log

mod_security configuration files

    /etc/httpd/conf.d/mod_security.conf - main configuration file for the mod_security Apache module.
    /etc/httpd/modsecurity-crs/ - all other configuration files for the mod_security Apache.
    /etc/httpd/modsecurity-crs/modsecurity_crs_10_config.conf - Configuration contained in this file should be customized for your specific requirements before deployment.
    /var/log/httpd/modsec_debug.log - Use debug messages for debugging mod_security rules and other problems.
    /var/log/httpd/modsec_audit.log - All requests that trigger a ModSecurity events (as detected) or a server error are logged ("RelevantOnly") are logged into this file.

*Any change made requires Apache restart
Code: [Select]
service httpd restart

56
Updates / Version 0.6 released
« on: January 26, 2014, 01:18:56 AM »
Version 0.6 (released 26/01/2014)
- New Design
- New Functions
- New Free DNS Manager
- Live Loading stats with AJAX
...and more

test and add yours comments here...

57
DNS Manager / Free DNS Manager
« on: January 24, 2014, 01:24:03 PM »
Test New Free Service: FreeDNS Manager
---------------------------------------------------

Now you can test new free service DNS Manager, this option will be added to new CWP version.

DNS Manager is free to use.

DNS Manager saves time needed for DNS configuration and requirements of additional IPs.

Register and start to use FreeDNS Manager
http://freedns.centos-webpanel.com/

58
Aplications / How to install wordpress to linux server
« on: January 02, 2014, 01:22:41 AM »
This is tutorial how to install and setup wordpress website on linux server with CentOS Web Panel (CWP)

Steps:
1. Create New Account from CWP under Accounts Menu
2. Create MySQL Database from CWP under SQL Services --> MySQL Manager --> Create Database and User
3. Download Wordpress installation files in users public_html folder

4a.
Install from SSH (do not forget to replace USERNAME with your users username)
cd /home/USERNAME/public_html
wget http://wordpress.org/latest.tar.gz
tar xvzf latest.tar.gz
mv wordpress/* .
rm -Rf wordpress
chown -R USERNAME:USERNAME *

4b.
Install as user with FTP
- Download latest wordpress installation from wordpress download site
- Extract files to your computer
- Connect to FTP with USER's login details you have entered when you created user account in CWP
- Upload all files you extracted to users remote FTP public_html folder

Now visit your website and install wordpress from browser by entering you MySQL database details/login data
Don't forget to save wp-config.php in your public_html folder

that is it you are ready to run yours wordpress website.

59
DNS / How to Setup DNS (BIND) on server
« on: December 24, 2013, 07:17:27 PM »
It's required that you have installed CentOS WebPanel and 2 IP addresses.


Settings
- DNS Functions --> Edit NameServers IPs
Add here your subdomains you want to use for NameServers and one IP for each nameserver eg.
ns1.centos-webpanel.com --> 185.4.149.83
ns1.centos-webpanel.com --> 185.4.149.90

- Your Main Domain or Subdomains need's to have A record to this server IPs

How to set A Records for Name Servers
1. Create new account on the server with domain name which you will use for nameservers (example: test.com)
2. Edit DNS zone for this domain go to DNS Functions --> List DNS Zones and click on your domain
3. Add records for your nameservers at end of the file:

ns1     14400   IN      A       NS1_SERVER IP
ns2     14400   IN      A       NS2_SERVER IP

example:

ns1     14400   IN      A       120.130.110.122
ns2     14400   IN      A       120.130.110.123
this will create nameservers: ns1.test.com and ns2.test.com

- Setup Shared IP
WebPanel Settings --> WebPanel Settings --> Shared IP


CASE 1
If you have only A record for main domain set to one IP than you need to make new account on this server and add in DNS records subdomains.

CASE 2
If you have at yours domain register set domain records for each subdomain to IP than you are ready to go and you can start adding DNS zones or creating accounts.

Changing DNS records can take up to 24 hours.

For some domain registers you will need to have your server hostname to have A record to NS1 IP:
eg.  myhostname.centos-webpanel.com --> 185.4.149.83

START DNS (BIND) server
go to Service Config --> Chkconfig manager and click "ON" for named service.
now go to index page and start BIND DNS Server by clicking Start



Don't forget that the nameservers must be registered with your domain registrar.

Godaddy Instructions
https://support.godaddy.com/help/article/12317/setting-custom-nameservers-for-domains-registered-with-us?locale=en

Enom Instructions
http://www.enom.com/help/faq_dns.asp

60
This are instructions for ProFTPd, CWP dose not use ProFTPd anymore


FTP Server Error: (Error in "MLSD" command While Connecting FTP to Server)

example:
Code: [Select]
Command: PASV
Response: 227 Entering Passive Mode (SERVER_IP,235,240).
Command: MLSD

This is CSF firewall blocking passive ports and you need to whitelist your ip or change some settings

You need to add passive ports in yours ProFTPd config: /etc/proftpd.conf
Code: [Select]
PassivePorts 30000 35000
in CWP go to Security --> CSF Firewall ==> Firewall Configuration
Under TCP_IN at end of the line add port range for FTP passive ports like: ,30000:35000

example of allowed tcp passive ports from: 30000:35000
Code: [Select]
# Allow incoming TCP ports
TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,2030,30000:35000"

now restart CSF firewall and you are ready to go.

More detailed info from CSF website
http://www.configserver.com/techfaq/faqlist.php?catid=6&faqid=67

Pages: 1 2 3 [4] 5