How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

January 15, 2019

MySQL database exists on the server, but does not show up in the cPanel

Filed under: Linux — Tags: , , — admin @ 2:22 pm

I have created a database manually on server with user_dbname however won’t show up on cpanel / phpmyadmin .

The solution was to run this

/usr/local/cpanel/bin/dbmaptool cpanelusername --type mysql --dbs 'nameofdatabase' --dbusers 'dbusername'

December 7, 2016

There was a problem removing the alias. Park::unpark( ) failed: You cannot unpark a user’s main domain name.

Filed under: Linux — Tags: , , — admin @ 11:37 am

Today I have another cpanel problem. Someone manage to add a domain as parking one and after this manage to create a main account also . Because the parking domain was first on httpd.conf vhosts when I was trying to access domain actually vhost was on parked one.  When I try to delete the parking from account the title of this subject was the error of the cpanel.

“There was a problem removing the alias. Park::unpark( ) failed: You cannot unpark a user’s main domain name.”

So how to fix this ?

Well first of all you will have a dns1 ( line on /var/cpanel/users/useraccount )

I delete this line but wasn’t enough .

After some search I find out that is also located into

/var/cpanel/userdata/username/

There are some files that they say not to modify them , but comparing two files one with parked and one without I figure it out what is the syntax. So I made a backup of original files and modify those from there  and delete parked domain .

After this you must run

/scripts/updateuserdomains

After I rebuild httpd.conf the domain was ok .

/scripts/rebuildhttpdconf

Hope this article will give some hint for someone else also .

The link that help me was from here

https://forums.cpanel.net/threads/error-from-domain-wrapper-subdomain-does-not-exist-for-user-solution.221782/

Also it appear this will influence /etc/userdatadomains

July 9, 2015

How To Restore a cPanel Server from old hard drive

Filed under: Linux — Tags: , , — admin @ 11:52 am

First of all this is a tutorial that you run it on your risk . Any way if you are in this situation a reinstall was done, and you have a snapshot mounted or old hard drive .
Also this is in case that you don’t have backup from whm and you can’t import them .

We are assuming that your old hard drive is mounted as ‘old-drive’

We sync important configuration from etc . Please after this don’t log out and try to log on your server . Here we re sync also the shadow this mean you will log using old password
cd /old-drive/etc/
rsync -avHz user* trueuser* domainips secondarymx domainalias valiases vfiltersexim* backupmxhosts proftpd* pure-ftpd* logrotate.conf passwd* group* *domain* *named* wwwacct.conf cpbackup.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts spammer* skipsmtpcheckhosts relay* localdomains remotedomains my.cnf /etc

Next is apache configuration
rsync -avHz /old-drive/usr/local/apache/conf /usr/local/apache
rsync -avHz /old-drive/usr/local/apache/modules /usr/local/apache
rsync -avHz /old-drive/usr/local/apache/domlogs /usr/local/apache

Dns configuration
rsync -avHz /old-drive/var/named /var

Cpanel restore
rsync -avHz /old-drive/usr/local/cpanel /usr/local

Mysql restoration
rsync -avHz /old-drive/var/lib/mysql /var/lib

cPanel files and templates
rsync -avHz /old-drive/var/cpanel /var

SSl certificates
rsync -avHz /old-drive/usr/share/ssl /usr/share

User bandwidth
rsync -avHz /old-drive/var/log/bandwidth /var/log

Mail queue
rsync -avHz /old-drive/var/spool/cron /var/spool

Mysql root password
rsync -avHz /old-drive/root/.my.cnf /root

Home user information ( this will take some time if you have huge websites )
rsync -avHz --exclude=virtfs/ /old-drive/home/* /home

We need to recompile and rebuild some files after copy this

/scripts/upcp --force
/scripts/easyapache
/scripts/initquotas
/scripts/eximup --force
/scripts/mysqlup --force
/etc/init.d/cpanel restart
/scripts/restartsrv_apache
/scripts/restartsrv_exim
/scripts/restartsrv_named

March 20, 2014

Create an FTP user on a cPanel server from shell

Filed under: Linux — Tags: , , , , , , — admin @ 11:18 am

Well today I wanted to make a script to automatically create some user for an account from shell, that’s because they where to many to make them manually from cpanel/whm . Also this command work on your server even if you have pure-ftpd or proftpd ) , because the cpanel keep the virtual user information into /etc/proftpd/ ( also there is a all user/password into /etc/proftpd/passwd.vhosts ) .

So , how to add a ftp user from shell ?
Well the syntax is :
/usr/local/cpanel/bin/proftpd_passwd -a ::::::

So first of all we have to know the uid and gid for this we can grep the passwd file.
grep /etc/passwd

Example how to add a username for matrafox system user :
grep matrafox /etc/passwd
matrafox:x:xxx:yyy::/home/matrafox:/usr/local/cpanel/bin/noshell
/usr/local/cpanel/bin/proftpd_passwd matrafox -a testuser:testpassword:xxx:yyy:matrafox:/home/matrafox/public_html:/sbin/nologin

If you want to detele a user the syntax is:
/usr/local/cpanel/bin/proftpd_passwd -d

Also if you manually edit a file you should run also the command so changes to take effect :
/usr/local/cpanel/bin/ftpupdate

March 14, 2013

Varnish Error 503 Service unavailable… Guru Meditation

Filed under: Linux — Tags: , , — admin @ 2:07 pm

Today I have face a big problem while using varnish with nginxcp + cpanel on a vps server .
Well the main site was working that was using a wordpress, however admin area because have a lot of plugins crashed with that stupid error.
So after a long search in ngnix log I find this error
upstream prematurely closed connection while reading response header from upstream
and this
an upstream response is buffered to a temporary file

However this seem’s that are not the problem for unavailable problem. However a fix for those error is to disable log in proxy.inc just add
proxy_buffering off;

However the fix is this in the varnish configuration default.vcl
backend default {
.host = “127.0.0.1”;
.port = “81”;
}

So after I modify this with

backend default {
.host = “127.0.0.1”;
.port = “81”;
.connect_timeout = 120s;
.first_byte_timeout = 120s;
.between_bytes_timeout = 120s;
}

The problem suddenly disappear . So basically the timeout should be increased for admin area if you have a lot of plugins there in wordpress and you are on a small vps.

Older Posts »

Powered by WordPress