·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设问答 >> 使用Webmin管理LNMP及Linux系统

使用Webmin管理LNMP及Linux系统

作者:佚名      网站建设问答编辑:admin      更新时间:2022-07-23

Webmin简介

Webmin是功能非常强大的Unix系统管理面板。管理员通过任何一款浏览器,就能添加用户帐号,管理Apache,DNS,文件共享系统,甚至更多。Webmin允许你DIY模块,你只需要到模块管理页面,增加你需要的功能,删除你认为不实用的功能。如果你熟悉perl,你甚至可以自己开发模块来增加Webmin功能。使用Webmin管理linux服务器,你将可以可视化管理你的服务器,完成脱离了命令行模式的管理方法。下面我们来介绍如何使用Webmin(下面的所有操作都是在centos中进行)。

yum安装nginx,php,mysql,fastcgi

LNMP(即nginx-mysql-php)服务器一直是被认为性能高,内存占用少的服务器,下面我们来介绍怎么通过简单的YUM命令安装。

安装mysql

1、先卸载系统自带的apache,然后更新软件库

yum remove httpd
yum update

2、yum安装mysql

yum install mysql mysql-server

3、加入启动项并启动mysql

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

4、设置mysql密码及相关设置

mysql_secure_installation

因为第一次启动这命令,所以直接回车下一步,然后输入你的mysql密码,按照提示操作。

安装nginx

1、导入软件库

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

2、yum安装nginx

yum install nginx

3、添加到启动项并启动nginx

chkconfig --levels 235 nginx on
/etc/init.d/nginx start

安装php

1、安装php及相关模块

yum install lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy

2、编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1

vi /etc/php.ini

3、执行以下命令以启动php fastcgi守护进程,并以用户组nginx和用户nginx身份运行。

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx -g nginx -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid

4、设置开机启动fastcgi.

编辑文件 vi /etc/rc.local,增加如下代码:

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx -g nginx -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid

修改nginx配置文件,添加fastcgi支持

1、修改nginx.conf文件

vi /etc/nginx/nginx.conf

配置文件部分代码:

[...]
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
[...]

2、重启nginx

/etc/init.d/nginx restart

3、建立info.php文件

vi /usr/share/nginx/html/info.php

添加如下代码:

<?php
phpinfo();
?>

在浏览器打开测试是否正常,如http://www.zhumaohai.com/info.php。