
Hướng dẫn cài đặt Nginx với PHP5 và MySQL hỗ trợ
trên Fedora 13
Nginx - hay còn phát âm là engine x, hiện đang là 1 trong
những hệ thống HTTP server miễn phí, mã nguồn mở và hi
ệu
suất hoạt động tương đối cao. Nginx còn được biết đến với độ
ổn định, giàu tính năng hỗ trợ, dễ dàng thiết lập, cấu hình và t
ốn ít
tài nguyên hệ thống. Trong bài viết sau, Quản Trị Mạng sẽ giới
thiệu với các bạn cách cài đặt Nginx trên nền tảng Fedora 13
server với PHP5 (qua FastCGI) và MySQL.
Lưu ý sơ bộ
Trong bài viết này, chúng ta sử dụng hostname
server1.example.com và địa chỉ IP 192.168.0.100. Tùy từng hệ
thống mà các bạn thay đổi thông số hostname và địa chỉ IP phù
hợp.
Cài đặt MySQL 5
Sử dụng câu lệnh sau để cài đặt MySQL 5:
yum install mysql mysql
-server

Sau đó tạo đường dẫn khởi động cho MySQL (dịch vụ của
MySQL sẽ tự khởi động cùng hệ thống) và kích hoạt MySQL
server:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
Kiểm tra các dịch vụ mạng có đang ở trạng thái kích hoạt hay
không:
netstat -tap | grep mysql
Kết quả hiển thị sẽ có dạng như sau:
[root@server1 ~]# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 1448/mysqld
[root@server1 ~]#
Nếu không, chỉnh lại file /etc/my.cnf và chú thích bên ngoài lựa
chọn skip-networking:
vi /etc/my.cnf
[...]
#skip-networking
[…]

Và khởi động lại MySQL server:
/etc/init.d/mysqld restart
Chạy lệnh sau:
mysql_secure_installation
để thiết lập mật khẩu cho tài khoản root (nếu không thì bất cứ ai
cũng có thể truy cập cơ sở dữ liệu MySQL):
[root@server1 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS
RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP
CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and

you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): <-- gõ ENTER
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the
MySQL
root user without the proper authorisation.
Set root password? [Y/n] <-- ENTER
New password: <-- mật khẩu SQL root
Re-enter new password: <-- mật khẩu SQL root
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user,
allowing anyone

to log into MySQL without having to have a user account created
for
them. This is intended only for testing, and to make the
installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <-- gõ ENTER
... Success!
Normally, root should only be allowed to connect from
'localhost'. This
ensures that someone cannot guess at the root password from the
network.
Disallow root login remotely? [Y/n] <-- gõ ENTER
... Success!
By default, MySQL comes with a database named 'test' that
anyone can

