快捷搜索:   服务器  安全  linux 安全  MYSQL  dedecms

LAMP服务器就环境的建立(4)

  ●整合apache 与php
  1、

  #vi /usr/local/httpd/httpd.conf 些模块简单的修改
  在配置文件中添加如下:
  AddType application/x-httpd-php .php .php3 .php4 .php5

  2、

  查找:(设置 WEB 默认文件)
  DirectoryIndex index.html

  替换为:
  DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件,httpd 就会执行 /var/www/error/noindex.html
  3、

  找到这一段:
  # AllowOverride controls what directives may be placed in .htaccess files.
  # It can be "All", "None", or any combination of the keywords:
  # Options FileInfo AuthConfig Limit
  #
  AllowOverride none

  更改为AllowOverride all
  允许apache rewrite

  4、启动cgi
  #AddHandler cgi-script .cgi 去掉#打开CGI脚本服务

  如果想同时运行扩展名为 .pl

  则改为:

  AddHandler cgi-script .cgi  .pl
  #/usr/local/httpd/bin/apachectl restart 重启一下apahce服务
  apache服务器的PHP配置完成。
  配置重新导入
  /etc/rc.d/init.d/xinetd restart

  ●测试服务器
  1、测试PHP
  进入Apache默认主目录/usr/local/httpd/htdocs,在该目录下建一个test.php文件
  #vi test.php 写入以一内容
  <?phpinfo();?>
  http://IP地址/phpinfo.php 就可以看到相关的服务信息啦

  2、测试cgi

  #cd /usr/local/apache2/

  #chmod 755 cgi-bin

  #cd cgi-bin

  #chmod 755 test-cgi

  或者在apache网站目录里编如下代码

  #vi test.cgi

  [#!/usr/bin/perl

  print "Content-type: text/html\n\n; ";
  print "Hello World\n";]

  ●安装phpmyadmin,管理mysql数据库

  # cd /usr/local/apache2/htdocs/
  # wget http://nchc.dl.sourceforge.net/sourc...-8-only.tar.gz

  # tar zxvf phpMyAdmin-2.11.1-all-languages-utf-8-only.tar.gz
  # mv phpMyAdmin-2.11.1-all-languages-utf-8-only phpmyadmin

  # cd phpmyadmin/libraries

  修改配置文件
  # vi config.default.php

  找到这几行进行修改:
  $cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (valid choices: config, http, HTTP, signon or cookie)
  $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
  $cfg['Servers'][$i]['password'] = 'PASSWORD'; // MySQL password (only needed

  经过这几个步骤,我们一个比较安全的LAMP服务器就环境基本建立成功啦。

顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论