Tải bản đầy đủ (.pdf) (4 trang)

Tài liệu Hướng dẫn cài đặt Nginx với PHP5 và MySQL hỗ trợ trên Fedora 13 pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (221.65 KB, 4 trang )

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
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <-- gõ ENTER
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <-- gõ ENTER
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
[root@server1 ~]#
Cài đặt Nginx
Các gói hỗ trợ cài đặt Nginx đã có sẵn trong Fedora 13, chúng ta dùng câu lệnh sau để bắt
đầu cài đặt:
yum install nginx
Sau đó tạo đường dẫn khởi động cho nginx và kích hoạt dịch vụ:
chkconfig --levels 235 nginx on
/etc/init.d/nginx start
Mở trình duyệt, gõ địa chỉ IP hoặc hostname vào thanh địa chỉ (ở đây là
http://192.168.0.100), bạn sẽ thấy giao diện trang mở đầu của nginx như sau:

×