Categories
Web Server

Plesk AH02291: Cannot access directory for error log

plesk repair fs example.com -y
mkdir /var/www/vhosts/system/example.com/logs/
chmod 700 /var/www/vhosts/system/example.com/logs/
chown psaadm:root /var/www/vhosts/system/example.com/logs/
rm -rf /var/www/vhosts/example.com/logs
plesk db "select name, login from domains join hosting on domains.id=hosting.dom_id join sys_users on hosting.sys_user_id=sys_users.id where name='example.com'";
+-------------+-------+
| name        | login |
+-------------+-------+
| example.com | jdoe  |
+-------------+-------+
plesk sbin relink-vhost-logs --domain-name example.com --sys-user-login jdoe --create

CentOS/RHEL

service httpd start
service nginx start

Debian/Ubuntu

service apache2 start
service nginx start
Categories
Database

Access MySQL Externally

Config update

nano /etc/mysql/mysql.conf.d/mysqld.cnf

Add this line

bind-address = 0.0.0.0

Allowing user on MySQL

mysql -u root -p

To check if the user can be accessed externally. If only localhost is listed, you are not allowed to access externally.

SELECT host FROM mysql.user WHERE User = 'root';

User creation

CREATE USER root@0.0.0.0 IDENTIFIED BY 'your_password';

Provide privileges

GRANT ALL PRIVILEGES ON *.* TO root@0.0.0.0;
FLUSH PRIVILEGES;
quit

MySQL Version 8.04+

Possible issue “Authentication plugin ‘caching_sha2_password’ and the fix is:

ALTER USER root@0.0.0.0
IDENTIFIED WITH mysql_native_password
BY 'your_password';

Restart MySQL

sudo systemctl restart mysql
Categories
Containers

Kubernetes Nginx

kubectl create deployment nginx --image=nginx:1.10.0
kubectl expose deployment nginx --port=80 --target-port=80 \
--type=LoadBalancer
Categories
Python

Regex Extract Python

import re
s = """
... some line abc
... some other line
... name my_user_name is valid
... some more lines"""
p = re.compile("name (.*) is valid")
result = p.search(s)
print(result.group(1))
Categories
Web Server

Change Hosts File

Linux and Mac

sudo nano /etc/hosts
127.0.0.1   localhost
YOUR_SERVER_IP yourdomain.com

Windows

Open c:\Windows\System32\Drivers\etc\hosts ( right click, run as administrator )

127.0.0.1   localhost
YOUR_SERVER_IP yourdomain.com