Skip to content

Instantly share code, notes, and snippets.

@quangbahoa
Created December 22, 2014 05:04
Show Gist options
  • Save quangbahoa/f708cf66e891ff5f728a to your computer and use it in GitHub Desktop.
Save quangbahoa/f708cf66e891ff5f728a to your computer and use it in GitHub Desktop.
Gist log test

Optimizing Apache for a VPS 1GB RAM!

Backup file config của Apache bằng lệnh dưới:

sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.backup.conf

Chỉnh sửa file config bằng lệnh dưới:

sudo nano /etc/apache2/apache2.conf

Trong file /etc/apache2/apache2.conf tìm:

KeepAlive On

Sửa thành:

KeepAlive Off

Thêm ngay bên dưới đoạn sau:

<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 75
MaxRequestsPerChild 2000
</IfModule>

Dùng tổ hợp phím CTRL + X để thoát khỏi editor. Nhập Y để đồng ý lưu các thay đổi Sau đỏ khởi động lại apache:

sudo service apache2 restart

Optimizing Mysql for a VPS 1GB RAM!

Sửa file config của mysql bằng lệnh dưới:

sudo nano /etc/mysql/my.cnf

Tìm các thuộc tính tương tự và sửa giá trị như bên dưới:

max_connections = 75
key_buffer = 32M
max_allowed_packet = 1M
thread_stack = 128K
table_cache = 32

Nếu các thuộc tính ở dạng #table_cache = 32 thì bỏ # để cấu hình có hiệu lực: table_cache = 32

**Dùng tổ hợp phím CTRL + X để thoát khỏi editor. Nhập Y để đồng ý lưu các thay đổi

Khởi động lại mysql bằng lệnh dưới:

sudo service mysql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment