工作忙,没有太多时间整理文档。请把笔记放上来吧。
安装系统,使用的是NET-INSTALL的ISO最小安装,只安装基本系统和系统工具。其他全部不安装,以保证系统的干净。
安装VIM编辑器
# apt-get install vim
安装SSH服务器
# apt-get install ssh
增加更新源
# vi /etc/apt/sources.list
##### 163 sources
deb http://mirrors.163.com/debian/ squeeze main non-free contrib
deb http://mirrors.163.com/debian/ squeeze-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian-security/ squeeze/updates main contrib non-free
deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze-proposed-updates main contrib non-free
deb-src http://mirrors.163.com/debian-security/ squeeze/updates main contrib non-free
#####
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
#####Nginx For Debian 6
deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx
下载nginx key并安装
#wget http://nginx.org/keys/nginx_signing.key
# apt-key add nginx_signing.key
下载dotdeb key并安装
# wget http://www.dotdeb.org/dotdeb.gpg
# apt-key add dotdeb.gpg
系统更新
# apt-get update
# apt-get upgrade
安装开发包
apt-get install build-essential
安装服务配置工具
# apt-get install chkconfig
安装查看用户工具
# apt-get install finger
安装解决ZIP工具
# apt-get install unzip
系统基本设定
记录开机启动日志
# vi /etc/default/bootlogd
BOOTLOGD_ENABLE=Yes
查看方法
cat /var/log/boot
让命令行显示彩色
进入用户主目录
# vi .bashrc
将以下内容前的#号去除
umask 022
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
设置DNS Server
# vi /etc/resolv.conf
nameserver 202.96.128.143
nameserver 8.8.8.8
nameserver 8.8.4.4
删除exim
# dpkg -l |grep exim
# apt-get remove --purge exim4 exim4-base exim4-config exim4-daemon-light
安装VMwareTools
要在“VM”选项中点击“Install VMware Tools”进行安装
关键是以下命令
# apt-get install linux-headers-$(uname -r)
# mount /dev/scd0 /mnt
复制VMware Tools工具包目录
# cd /mnt
解压
# cd vmware-tools-distrib/
# ./vmware-install.pl
之后一路回车,然后重启电脑
安装nginx
# apt-get install nginx
创建网页目录
# mkdir -p /opt/data/html
#设置目录所有者
# chown nginx.nginx /opt/data -R
设置nginx运行的进程数
# vi /etc/nginx/nginx.conf
worker_processes 4
设置网页主目录
# vi /etc/nginx/conf.d/default.conf
location / {
root /opt/data/html;
index index.php index.html index.htm;
}
重启nginx
# service nginx restart
访问网址出现以下代表正确
403 Forbidden
安装MySQL
# apt-get install mysql-server-5.5
根据提示输入mysql root的密码
以下命令修改mysql安全设置
# mysql_secure_installation
Enter current password for root (enter for none):enter //初始密码为你安装mysql时的,直接回车即可
Set root password? [Y/n]Y //是否设置root密码
New password: //新的密码
Re-enter new password://再次输入密码
Remove anonymous users? [Y/n]Y //是否删除匿名用户
Disallow root login remotely? [Y/n]n //是否不允许远程连接数据库
Remove test database and access to it? [Y/n]Y //删除test数据库
Reload privilege tables now? [Y/n]Y //重载权限
安装PHP5
apt-get install php5-fpm php5-cgi php5-cli php5-curl php5-ffmpeg php5-mysql php5-gd libjpeg8-dev php5-imap php5-ldap php5-odbc php*-pear php5-mcrypt php5-mhash libmcrypt* libmcrypt-dev php5-common php5-idn php5-imagick php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json php5-suhosin php-apc php5-dev
配置PHP
# vi /etc/php5/fpm/php.ini
cgi.fix_pathinfo=1
upload_max_filesize = 8M
magic_quote_gpc = On
open_basedir =/opt/data/html/:/tmp/
[Date]
date.timezone = "Asia/Shanghai"
date.default_latitude = 31.5167
date.default_longitude = 121.4500
配置nginx支持php
# vi /etc/nginx/conf.d/default.conf
找到# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
换成以下
location ~ ^(.+\.php)(.*)$ {
root /opt/data/html;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
重启
# reboot
配置PHPMYADMIN
从官方网站下载最新的phpmyadmin版本,解压至网站相应目录。
然后访问http://服务器域名或IP/phpmyadmin
重启nginx
测试pathinfo方法:
将以下代码写入文件,上传至服务器访问测试 ,主要是在后面输入不存在的文件名
pathifo.php
<?php
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
?>
安装系统,使用的是NET-INSTALL的ISO最小安装,只安装基本系统和系统工具。其他全部不安装,以保证系统的干净。
安装VIM编辑器
# apt-get install vim
安装SSH服务器
# apt-get install ssh
增加更新源
# vi /etc/apt/sources.list
##### 163 sources
deb http://mirrors.163.com/debian/ squeeze main non-free contrib
deb http://mirrors.163.com/debian/ squeeze-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian-security/ squeeze/updates main contrib non-free
deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze-proposed-updates main contrib non-free
deb-src http://mirrors.163.com/debian-security/ squeeze/updates main contrib non-free
#####
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
#####Nginx For Debian 6
deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx
下载nginx key并安装
#wget http://nginx.org/keys/nginx_signing.key
# apt-key add nginx_signing.key
下载dotdeb key并安装
# wget http://www.dotdeb.org/dotdeb.gpg
# apt-key add dotdeb.gpg
系统更新
# apt-get update
# apt-get upgrade
安装开发包
apt-get install build-essential
安装服务配置工具
# apt-get install chkconfig
安装查看用户工具
# apt-get install finger
安装解决ZIP工具
# apt-get install unzip
系统基本设定
记录开机启动日志
# vi /etc/default/bootlogd
BOOTLOGD_ENABLE=Yes
查看方法
cat /var/log/boot
让命令行显示彩色
进入用户主目录
# vi .bashrc
将以下内容前的#号去除
umask 022
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
设置DNS Server
# vi /etc/resolv.conf
nameserver 202.96.128.143
nameserver 8.8.8.8
nameserver 8.8.4.4
删除exim
# dpkg -l |grep exim
# apt-get remove --purge exim4 exim4-base exim4-config exim4-daemon-light
安装VMwareTools
要在“VM”选项中点击“Install VMware Tools”进行安装
关键是以下命令
# apt-get install linux-headers-$(uname -r)
# mount /dev/scd0 /mnt
复制VMware Tools工具包目录
# cd /mnt
解压
# cd vmware-tools-distrib/
# ./vmware-install.pl
之后一路回车,然后重启电脑
安装nginx
# apt-get install nginx
创建网页目录
# mkdir -p /opt/data/html
#设置目录所有者
# chown nginx.nginx /opt/data -R
设置nginx运行的进程数
# vi /etc/nginx/nginx.conf
worker_processes 4
设置网页主目录
# vi /etc/nginx/conf.d/default.conf
location / {
root /opt/data/html;
index index.php index.html index.htm;
}
重启nginx
# service nginx restart
访问网址出现以下代表正确
403 Forbidden
安装MySQL
# apt-get install mysql-server-5.5
根据提示输入mysql root的密码
以下命令修改mysql安全设置
# mysql_secure_installation
Enter current password for root (enter for none):enter //初始密码为你安装mysql时的,直接回车即可
Set root password? [Y/n]Y //是否设置root密码
New password: //新的密码
Re-enter new password://再次输入密码
Remove anonymous users? [Y/n]Y //是否删除匿名用户
Disallow root login remotely? [Y/n]n //是否不允许远程连接数据库
Remove test database and access to it? [Y/n]Y //删除test数据库
Reload privilege tables now? [Y/n]Y //重载权限
安装PHP5
apt-get install php5-fpm php5-cgi php5-cli php5-curl php5-ffmpeg php5-mysql php5-gd libjpeg8-dev php5-imap php5-ldap php5-odbc php*-pear php5-mcrypt php5-mhash libmcrypt* libmcrypt-dev php5-common php5-idn php5-imagick php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json php5-suhosin php-apc php5-dev
配置PHP
# vi /etc/php5/fpm/php.ini
cgi.fix_pathinfo=1
upload_max_filesize = 8M
magic_quote_gpc = On
open_basedir =/opt/data/html/:/tmp/
[Date]
date.timezone = "Asia/Shanghai"
date.default_latitude = 31.5167
date.default_longitude = 121.4500
配置nginx支持php
# vi /etc/nginx/conf.d/default.conf
找到# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
换成以下
location ~ ^(.+\.php)(.*)$ {
root /opt/data/html;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
重启
# reboot
配置PHPMYADMIN
从官方网站下载最新的phpmyadmin版本,解压至网站相应目录。
然后访问http://服务器域名或IP/phpmyadmin
重启nginx
测试pathinfo方法:
将以下代码写入文件,上传至服务器访问测试 ,主要是在后面输入不存在的文件名
pathifo.php
<?php
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
?>
本文转自 ljpwinxp 51CTO博客,原文链接:http://blog.51cto.com/191226139/861789