cat /etc/hostname
SRV1
echo "SRV1 127.0.0.1" >> /etc/hosts
Monthly Archives: October 2020
ngxtop
yum install python-pip
pip install ngxtop
ngxtop parses your nginx access log and outputs useful, top-like, metrics of your nginx server. So you can tell what is happening with your server in real-time
ngxtop
running for 411 seconds, 64332 records processed: 156.60 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 64332 | 2775.251 | 61262 | 2994 | 71 | 5 |
SYSERR(autoresponse): Too many hops 27 (25 max): from mailer-daemon via localhost, to
autoresponse[66556]: Unauthenticated attempt to set autoresponse message for mailer-daemon from 127.0.0.1!
Authentication-Warning: autoresponse set sender to mailer-daemon using -f
SYSERR(autoresponse): Too many hops 27 (25 max): from mailer-daemon via localhost, to
DSN: Too many hops 27 (25 max): from mailer-daemon via localhost, to
relay=autoresponder, delay=0.18, delays=0.06/0/0/0.13, dsn=5.3.0, status=bounced (service unavailable)
yum remove sendmail
service postfix restart
VsFTPD virtual host ubuntu
vsftpd read only user
apt-get update
apt-get install vsftpd libpam-pwdfile
cp -v /etc/vsftpd.conf /etc/vsftpd.conf.bak
vi /etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
user_config_dir=/etc/vsftpd/vsftpd-virtual-user/
virtual_use_local_privs=YES
dual_log_enable=YES
connect_from_port_20=YES
listen=YES
pam_service_name=ftp
tcp_wrappers=YES
allow_writeable_chroot=YES
service vsftpd restart
mkdir -p -v /etc/vsftpd/vsftpd-virtual-user/
cp -v /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bak
session optional pam_keyinit.so force revoke
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_shells.so
auth include system-auth
account include system-auth
session include system-auth
session required pam_loginuid.so
useradd --home /home/user --gid nogroup -m --shell /bin/false user
passwd user
echo user >> /etc/vsftpd/vsftpd-virtual-user/vsftpd_user
vi /etc/vsftpd/vsftpd-virtual-user/user
local_root=/home/USERNAME
cmds_allowed=USER,PASS,SYST,FEAT,OPTS,PWD,TYPE,PASV,LIST,STOR,CWD,MKD,SIZE,MDTM,CDUP,RETR,RNFR,RNTO,QUIT
local_umask=022
write_enable=YES
To allow delete add DELE
Other options:
cmds_allowed=ABOR,CWD,LIST,MDTM,MKD,NLST, PASS,PASV,PORT,PWD,QUIT,RETR,RMD,RNFR, RNTO,SITE,SIZE,STOR,TYPE,USER,ACCT, APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST
Allow another user write STOR files: usermod -a -G user another_user
ubuntu mysql 8
wget -c https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb
dpkg -i mysql-apt-config_0.8.13-1_all.deb
apt update
apt install mysql-server
mysql.ping mysqladmin: connect to server at ‘localhost’ failed
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'zabbix'@'localhost' (using password: NO)'
0
Fix:
UserParameter=mysql.ping,mysqladmin --defaults-extra-file='/etc/zabbix/.my.cnf' ping | grep -c alive
dpkg: error processing package redis (–configure)
dpkg: error processing package redis-server (–configure):
installed redis-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of redis:
redis depends on redis-server (<< 5:4.0.9-1ubuntu0.2.1~); however:
Package redis-server is not configured yet.
redis depends on redis-server (>= 5:4.0.9-1ubuntu0.2); however:
Package redis-server is not configured yet.
dpkg: error processing package redis (–configure):
dependency problems – leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1.2) …
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (237-3ubuntu10.42) …
vi /etc/redis/redis.conf
bind 127.0.0.1
supervised systemd
Again:
apt install redis-server
pecl another php version
pecl multiple php version
pecl install mcrypt
pecl/mcrypt is already installed and is the same as the released version 1.0.3
install failed
update-alternatives –config=php
update-alternatives –config=php-config
update-alternatives –config=phpize
pecl install -f pecl
Also can help config-set:
pecl config-set ext_dir /usr/lib/php/20201226
pecl config-set php_bin /usr/bin/php7.4
pecl config-set php_ini /etc/php/7.4/cli/php.ini
pear config-set ext_dir /usr/lib/php/20201226
pear config-set php_bin /usr/bin/php7.4
certbot renew cron job
0 0 * * * certbot renew --post-hook "systemctl reload nginx"
monit port
check host nginx with address 127.0.0.1
start program = "/bin/systemctl start nginx"
stop program = "/bin/systemctl stop nginx"
if failed port 80 then restart
if 5 restarts within 5 cycles then timeout
cPanel change email password command line
Change info password
pass=$(python3 -c 'import crypt; print(crypt.crypt("mynewpassword", crypt.mksalt(crypt.METHOD_SHA512)))') ; sed -e -i "s,^info:[^:]\+:,info:$pass:," /home/cpanel_username/etc/yourdomain.com/shadow
dsn=5.4.6, status=bounced (mail for gmail.com loops back to myself)
If you are using NAT make sure DNS have destination IP address
-A PREROUTING -d 192,168.4.111/32 -i enp0s31f6 -p tcp -m tcp --dport 25 -j DNAT --to-destination 192.168.1.111:25
mysql client cannot find socket
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
mysqld --verbose --help | grep ^socket
socket /var/lib/mysql/mysql.sock
varnish can not change port
If you want to change to 8888:
grep -R 'ExecStart=/usr/sbin/varnishd' /etc/
/etc/systemd/system/multi-user.target.wants/varnish.service:ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :8888 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
systemctl daemon-reload
systemctl restart varnish.service
nothing provides perl(IO::Stringy) needed by amavis-2.12.0-9.el8.noarch (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)
dnf --enablerepo=epel,PowerTools -y install amavisd-new clamd perl-Digest-SHA1 perl-IO-stringy