- Change the default SSH 22 port
- Use strong password
- Using SSH key authentication instead of password authentication
- Use The Latest Software Versions
- Monitor Your VPS Server Logs
- Set up email notifications for any warnings and errors
- Set Up Your Firewall
- Make Sure Your Server Is Malware-protected
- Protect Against Brute-force Attacks
- Use SSL Certificates For Everything
Fix read only fstab
- “/ etc/fstab” [readonly]
- can’t edit fstab read only
- file ‘/ etc/fstab’ is unwritable
- Repairing fstab (read only /)
If / etc/fstab is correct, you can simply type:
mount -n -o remount /
But if / etc/fstab is wrong, the device name and possibly the type must have to be given too: e.g.
mount -n -o remount -t extX /dev/sdaX /
Where,
extX is your filesystem type
/dev/sdaX is the partition you want to mount
To see all your available partitions just type ls /dev/[sh]d*.
MySQL database table “in use” problem
- MySQL table collation suddenly changed to “in use”
- Unable to login, registration, reset password
Backup database.
Error occurs when you set the connection collation to anything other then the current server collation.
So
- Repair database (repairing database will fix the “in use” issue)
- Then change the collation to same everywhere.
- You may also check the collation in the config file.
That’s all!
Changing the partition layout of your VPS and VDS after installation | Linux
- How to easily change your partition layout on your VPS or VDS.
Backup of all important data before proceeding! Changes to the partition table always bear the risk of complete data loss.
- Boot your VPS / VDS into the rescue-system
- Now connect through VNC (How to use VNC to connect to your VPS and VDS)
- Login as “root”
- To perform changes on the partition easily use gparted
- To start the GUI type “startxfce4” within VNC console and wait a few seconds until the graphical interface appears
- On the upper left side you will see “Applications”, open it and select “Run Program”
- Type “gparted” within the application finder and the app should start immediately
- Now you can resize and create new partition with unallocated space.
How to increase memory limit?
- Fatal error: Allowed memory size of 123456 bytes exhausted (tried to allocate 234567 bytes) in /path/file.php
Usually your php.ini will be located at (XX – PHP version, for example 73):
vi /usr/local/php73/lib/php.ini
or use below trick to find your php.ini would be to ask php itself what it’s using, eg:
/usr/local/bin/php --ini | grep 'Loaded Configuration File'
or another trick to find php.ini
php -i | grep "php.ini"
Now open the php.ini file and edit memory_limit to a higher value.
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
Save, and then restart apache.
systemctl start httpd.service
CentOS/RHEL (Red Hat) Linux version 7.x or newer specific commands
or
sudo systemctl restart httpd.service
Alternative way: php.ini per folder
Location of the global server php.ini file is
/usr/local/php/php.ini
Location of the global per account php.ini file is
/home/USERNAME/php.ini
You can also have per folder changes, example:
/home/USERNAME/public_html/website1.com/php.ini /home/USERNAME/public_html/website2.com/php.ini /home/USERNAME/public_html/website2.com/myapp/php.ini
How to test php.ini changes?
Simple create phpinfo.php file in the users public_html folder and add the following content in it.
Example location: /home/USERNAME/public_html/phpinfo.php
<?php
phpinfo();
?>
Now open url in your browser (Apache restart is NOT needed):
http://your-domain.com/phpinfo.php
PHP.ini values
http://php.net/manual/en/ini.list.php
- « Previous Page
- 1
- …
- 7
- 8
- 9
- 10
- 11
- …
- 15
- Next Page »