葛廷彬的学习博客

记录学习工作中碰到的问题

阿里云服务器web+mysql

 


帐号root
密码:
----------------------------------------
测试url:
http://127.0.0.1/phpinfo.php
http://127.0.0.1/sql.php
----------------------数据库-------------------------------
地址:127.0.0.1
mysql数据库:
账户:root
密码:123654
----------------------FTP服务器-------------------------------
地址1:127.0.0.1
mysql数据库:
账户:ftpuser
密码:123654
物理路径:/mnt/www


----------------------重启集合:维护必须----------------------
[root@localhost ~]#service nginx restart
[root@localhost ~]#service mysqld restart
[root@localhost ~]#service php-fpm restart
[root@localhost ~]#service vsftpd restart
[root@iZ28bgyuhqaZ www]# chmod -R 777 /mnt


---------------------------------------------------------------------------------------------------------------------------
4.1检测版本:
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@localhost ~]# getconf LONG_BIT
64
[root@localhost ~]# cat /proc/version
Linux version 2.6.32-431.el6.x86_64


4.2:检查设置正确的系统时间:
[root@localhost ~]# date;hwclock -r #显示时间
[root@localhost ~]#date -s 20141226  #设置年月日
[root@localhost ~]#date -s 15:50:00  #设置时间
[root@localhost ~]#ntpdate time.windows.com && hwclock -w #时间同步
[root@localhost ~]#service ntpd start 或/etc/init.d/ntpd start  #开启自动时间同步服务


----------------------防火墙配置-------------------------------
先安装下防火墙程序:
[root@iZ25v07clasZ ftp]#  yum install iptables
编辑防火墙:
[root@localhost ~]#vi /etc/sysconfig/iptables
rm -rf /etc/sysconfig/iptables
------------开始------------------------------------------------
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp -s 58.56.89.220  -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp -s 124.128.23.78  -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

  
-----------结束------------------------------------------------
[root@localhost ~]#chkconfig --levels 2345 iptables on  && chkconfig --list iptables  && service iptables start
[root@localhost ~]#service iptables restart  #重启下防火墙才能生效
---------------------------------------------------------------------------------------------------------------------------
2:查看系统分区,挂在数据盘:
2.1查看磁盘分区
###############无挂载磁盘
[root@localhost ~]# df -h  
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G  1.4G   18G   8% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
#################有挂载磁盘
[root@localhost ~]# df -h   
Filesystem      Size  Used Avail Use% Mounted on


/dev/xvda1       20G  1.4G   18G   8% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
/dev/xvdb1      252G  188M  240G   1% /mnt
 [root@localhost ~]#fdisk -l    #可列出所有磁盘的相关分区信息
---------------------------------------------------------------------------------------------------------------------------
2.2 对数据盘进行分区
[root@localhost ~]#fdisk -S 56 /dev/xvdb
#对数据盘进行分区;
根据提示,依次输入“n”,“p”“1”,两次回车,“wq”,分区就开始了,很快就会完成。
2.3、 查看新的分区
 [root@localhost ~]#fdisk -l
2.4、格式化新分区
[root@localhost ~]#mkfs.ext3 /dev/xvdb1    #对新分区进行格式化,格式化的时间根据硬盘大小有所不同。

2.5、添加分区信息
 [root@localhost ~]#echo '/dev/xvdb1  /mnt ext3    defaults    0  0' >> /etc/fstab
#(不含引号)命令写入新分区信息,如果需要把数据盘单独挂载到某个文件夹,比如单独用来存放网页,可以修改以上命令中的/mnt部分。
[root@localhost ~]#cat /etc/fstab

2.6、挂载新分区
[root@localhost ~]#mount -a
---------------------------------------------------------------------------------------------------------------------------
3:设置自动更新源(阿里云特有)
wget http://oss.aliyuncs.com/aliyunecs/update_source.tgz && tar xvf update_source.tgz && bash update_source.sh


-------------------------
#############################################################5:安装LNMP#######################################################################
yum install  php-mcrypt  libmcrypt  libmcrypt-devel  perl libaio 
wget http://124.128.23.70:1436/linux/nginx-1.4.7.tar.gz  && wget http://124.128.23.70:1436/linux/php-5.6.25.tar.gz && wget http://124.128.23.70:1436/linux/mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz

#############开始安装nginx#############################################################
[root@localhost ~]# cd /root && tar xf nginx-1.4.7.tar.gz    
[root@localhost ~]# mv /root/nginx-1.4.7 /usr/local/nginx  #改名
[root@localhost ~]# cd /usr/local/nginx/
[root@localhost ~]# groupadd -g 108  -r nginx #添加组
[root@localhost ~]# useradd -u 108 -r -g 108 nginx  #新建nginx用户
[root@localhost ~]# cut -d : -f 1 /etc/passwd  查看系统中有哪些用户
[root@localhost ~]# userdel nginx.删除多余用户
[root@localhost ~]# id nginx    #查询账户id
[root@localhost ~]# chown -R root:nginx /usr/local/nginx/*    #授权
[root@localhost ~]# yum  install  gcc  pcre-devel  openssl-devel #安装必须插件
[root@localhost ~]# ./configure   --prefix=/usr   --sbin-path=/usr/sbin/nginx   --conf-path=/etc/nginx/nginx.conf   --error-log-path=/var/log/nginx/error.log   --http-log-path=/var/log/nginx/access.log   --pid-path=/var/run/nginx/nginx.pid    --lock-path=/var/lock/nginx.lock   --user=nginx   --group=nginx   --with-http_ssl_module   --with-http_flv_module   --with-http_stub_status_module   --with-http_gzip_static_module   --http-client-body-temp-path=/var/tmp/nginx/client/   --http-proxy-temp-path=/var/tmp/nginx/proxy/   --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/   --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi   --http-scgi-temp-path=/var/tmp/nginx/scgi   --with-pcre
[root@web nginx]# make && make install


配置启动程序:
vi  /etc/init.d/nginx
-----------------开始线----------------------------------------------------
 #!/bin/sh
 #
 # nginx - this script starts and stops the nginx daemon
 #
 # chkconfig:   - 85 15
 # description:  Nginx is an HTTP(S) server, HTTP(S) reverse \
 #               proxy and IMAP/POP3 proxy server
 # processname: nginx
 # config:      /etc/nginx/nginx.conf
 # config:      /etc/sysconfig/nginx
 # pidfile:     /var/run/nginx.pid
 # Source function library.
 . /etc/rc.d/init.d/functions
 # Source networking configuration.
 . /etc/sysconfig/network
 # Check that networking is up.
 [ "$NETWORKING" = "no" ] && exit 0
 nginx="/usr/sbin/nginx"
 prog=$(basename $nginx)
 NGINX_CONF_FILE="/etc/nginx/nginx.conf"
 [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
 lockfile=/var/lock/subsys/nginx
 make_dirs() {
    # make required directories
    user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
    options=`$nginx -V 2>&1 | grep 'configure arguments:'`
    for opt in $options; do
        if [ `echo $opt | grep '.*-temp-path'` ]; then
            value=`echo $opt | cut -d "=" -f 2`
            if [ ! -d "$value" ]; then
                # echo "creating" $value
                mkdir -p $value && chown -R $user $value
            fi
        fi
    done
 }
 start() {
     [ -x $nginx ] || exit 5
     [ -f $NGINX_CONF_FILE ] || exit 6
     make_dirs
     echo -n $"Starting $prog: "
     daemon $nginx -c $NGINX_CONF_FILE
     retval=$?
     echo
     [ $retval -eq 0 ] && touch $lockfile
     return $retval
 }
 stop() {
     echo -n $"Stopping $prog: "
     killproc $prog -QUIT
     retval=$?
     echo
     [ $retval -eq 0 ] && rm -f $lockfile
     return $retval
 }
 restart() {
     configtest || return $?
     stop
     sleep 1
     start
 }
 reload() {
     configtest || return $?
     echo -n $"Reloading $prog: "
     killproc $nginx -HUP
     RETVAL=$?
     echo
 }
 force_reload() {
     restart
 }
 configtest() {
   $nginx -t -c $NGINX_CONF_FILE
 }
 rh_status() {
     status $prog
 }
 rh_status_q() {
     rh_status >/dev/null 2>&1
 }
 case "$1" in
     start)
         rh_status_q && exit 0
         $1
         ;;
     stop)
         rh_status_q || exit 0
         $1
         ;;
     restart|configtest)
         $1
         ;;
     reload)
         rh_status_q || exit 7
         $1
         ;;
     force-reload)
         force_reload
         ;;
     status)
         rh_status
         ;;
     condrestart|try-restart)
         rh_status_q || exit 0
             ;;
     *)
         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
         exit 2
 esac
-----结束线----------------------------------------------------------------
[root@localhost nginx]# chmod +x /etc/init.d/nginx #增加权限
[root@localhost nginx]# chkconfig --add nginx && chkconfig --levels 235 nginx on && chkconfig --list nginx
[root@localhost nginx]# mkdir –pv /mnt/www/ #创建网站目录
[root@localhost nginx]# chmod -R 777 /mnt   #授权
[root@localhost nginx]# cd /mnt/www/
[root@localhost www]# vi index.html   #随便写点啥
[root@localhost www]# vi /etc/nginx/nginx.conf  #修改nginx配置文件

location / {
             root   /mnt/www;   #修改目录指向
             index  index.html index.htm;
          }

[root@localhost ~]# mkdir  /var/tmp/nginx &&  mkdir  /var/tmp/nginx/client   #如果不创建启动会报错
[root@localhost ~]# service nginx start
[root@localhost ~]# service nginx restart

################ MySQL安装和配置#########################################################

[root@localhost ~]# groupadd -r mysql  #新建用户组以安全方式运行进程
[root@localhost ~]# mkdir –pv  /mnt/data 
[root@localhost ~]# useradd -g mysql -r -s /sbin/nologin -M -d /mnt/data mysql #新建用户以安全方式运行进程
[root@localhost ~]# chown -R mysql:mysql /mnt/data
[root@localhost ~]# cd /root && tar -xf mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz -C /usr/local/         #-C指定解压目录
[root@localhost ~]# mv /usr/local/mysql-5.6.15-linux-glibc2.5-x86_64 /usr/local/mysql        #移动哈
[root@localhost ~]# cd /usr/local/mysql
[root@localhost mysql]# chown -R mysql:mysql .    #更改属主属组

[root@localhost mysql]# scripts/mysql_install_db --user=mysql --datadir=/mnt/data    #执行mysql 初始化的data存放位置的准备
[root@localhost mysql]# ll /mnt/data/                                             #查看 data 目录有文件说明初始化成功

[root@localhost mysql]# chown root /usr/local/mysql/* -R   #初始化完成后mysql中目录文件的属主应改回成root,以免被别人攻破mysql用户密码而带来数据破坏等
[root@localhost mysql]# ll
[root@localhost mysql]# cat my.cnf #配置文件
[root@localhost mysql]# rm -rf /usr/local/mysql/my.cnf  #修改配置文件
[root@localhost mysql]# vi /usr/local/mysql/my.cnf  #修改配置文件
添加内容是:
----------开始:-------------------- vi /usr/local/mysql/my.cnf----------------------------------------------------
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'

 skip-name-resolve
 binlog-format=ROW
 log-bin=master-bin.log
 log-slave-updates=true
 gtid-mode=on
 enforce-gtid-consistency=true
 master-info-repository=TABLE
 relay-log-info-repository=TABLE
 sync-master-info=1
 slave-parallel-workers=2
 binlog-checksum=CRC32
 master-verify-checksum=1
 slave-sql-verify-checksum=1
 binlog-rows-query-log_events=1
 server-id=1
 report-port=3306
 port=3306
 datadir=/mnt/data
 socket=/tmp/mysql.sock
 report-host=master.test.com

----------结束------------------------------- vi /usr/local/mysql/my.cnf----------------------------------------------------

[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld      #复制sysv脚本
[root@localhost mysql]# chkconfig --add mysqld && chkconfig --levels 235 mysqld on && chkconfig mysqld --list
[root@localhost mysql]# service mysqld start
[root@localhost mysql]# netstat -ntulp                 #查看端口
[root@localhost ~]# service mysqld restart
#输出mysql的man手册至man命令的查找路径
[root@localhost mysql]# vi /etc/man.config 
 MANPATH /usr/local/mysql/man   #增加这1行
 
 #输出mysql的头文件至系统头文件路径/usr/include
[root@localhost mysql]#ln -sv /usr/local/mysql/include/ /usr/include/mysql       #输出mysql的头文件至系统头文件
[root@localhost mysql]# cd /usr/include/mysql/

#输出mysql的库文件给系统库查找路径
[root@localhost mysql]# vi /etc/ld.so.conf.d/mysql.conf
 /usr/local/mysql/lib                                   #直接新建编辑/etc/ld.so.conf.d/mysql.conf文件,把mysql的库文件路径添加进去就可以了
[root@localhost mysql]# ldconfig -v                # 让系统重新读取库文件

修改PATH环境变量,让系统可以直接使用mysql的相关命令
[root@localhost mysql]# vi /etc/profile.d/mysql.sh   #添加环境变量(与添加httpd是1样的)
exportPATH=$PATH:/usr/local/mysql/bin
[root@localhost mysql]# source /etc/profile      #重新读取1下环境变量
[root@localhost mysql]#ln -s /usr/local/mysql/bin/mysql /usr/bin #设置软链接


3:修改下mysql的访问控制
[root@localhost mysql]# mysql
mysql> show databases;          (查看存在的数据库)
mysql>SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%'; #查看MySQL Server的字符集
mysql> use mysql                 (进入系统数据库)
mysql> show tables;                (查看系统数据库表)
mysql> update `user` SET `Host`='%' WHERE `User`='root' LIMIT 1;

(允许办公网络ip访问mysql)
mysql> update user set password=password('123654') where user='root';
#修改密码
mysql>flush privileges;
mysql>exit    (退出)
[root@localhost ~]# service mysqld restart        (重启mysql使上述配置生效)


########开始装PHP吧#################################################################

[root@localhost ~]#yum -y groupinstall "Development Tools"
[root@localhost ~]#yum  install  libmcrypt libmcrypt-devel mhash mhash-devel mcrypt libevent libevent-devel gd gd-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel bzip2 bzip2-devel libcurl libcurl-devel
[root@localhost ~]#cd /root && tar zvxf php-5.6.25.tar.gz && cd php-5.6.25
[root@localhost ~]#./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm --enable-sockets --enable-sysvshm  --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir=/usr/ --enable-xml  --with-mhash --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-curl
[root@localhost ~]# make && make install
#为php提供配置文件
[root@localhost php-5.6.25]# cp /root/php-5.6.25/php.ini-production /etc/php.ini

#为php-fpm提供Sysv init脚本,并将其添加至服务列表
[root@localhost php-5.6.25]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost php-5.6.25]# chmod +x /etc/init.d/php-fpm && chkconfig --add php-fpm && chkconfig --levels 235 php-fpm on && chkconfig --list php-fpm


#为php-fpm提供配置文件
[root@localhost php-5.6.25]# cd /usr/local/php/
[root@localhost php]# cd etc/
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# chmod -R 777 /usr/local/php/var/run
[root@localhost etc]# vi php-fpm.conf

pm.max_children = 150
pm.start_servers = 8
pm.min_spare_servers = 5
pm.max_spare_servers = 10
;pid = /usr/local/php/var/run/php-fpm.pid

[root@localhost etc]# service php-fpm start
[root@localhost etc]# ps aux | grep php-fpm


##################################整合Nginx与PHP (FastCGI)########################################
#整合Nginx与PHP (FastCGI)

[root@localhost etc]# rm -rf /etc/nginx/nginx.conf
[root@localhost etc]# vi /etc/nginx/nginx.conf
[root@localhost etc]# vi /etc/nginx/fcgi.conf
---------------------开始------vi /etc/nginx/nginx.conf万能配置----------------------------
## whbmemo:所有的后置WEB服务器,配置完全一样
user  nginx nginx;
worker_processes 1;
error_log  /var/log/nginx/access.log  crit;
pid      /var/run/nginx/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;

events
{
  use epoll;
  worker_connections 65535;
}

http
{
 include       mime.types;
    default_type  application/octet-stream;
 charset  utf-8; #gb2312
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
 client_max_body_size 30m;
    large_client_header_buffers 4 32k;
 keepalive_timeout 60;

 ## whbmemo:配置fastcgi,以便支持PHP
 fastcgi_connect_timeout 300;
 fastcgi_send_timeout 300;
 fastcgi_read_timeout 300;
 fastcgi_buffer_size 64k;
 fastcgi_buffers 4 64k;
 fastcgi_busy_buffers_size 128k;
 fastcgi_temp_file_write_size 128k; 

 ## whbmemo:配置gzip压缩参数(待测)
 gzip on;
 gzip_min_length  1k;
 gzip_buffers     4 16k;
 gzip_http_version 1.0;
 gzip_comp_level 2;
 gzip_types       text/plain application/x-javascript text/css application/xml;
 gzip_vary on;

 ## whbmemo:配置虚拟主机 (gongyidianping.com)
 server
 {
  listen       80;
  server_name  zwty.longcity.net;
  index index.html index.htm index.php;
  root  /mnt/www;
  server_tokens off;  #去除版本号暴漏
  ## whbmemo:配置本网站访问日志
  #log_format  www_mmzzb_com_access  '$remote_addr - $remote_user [$time_local] "$request" '
  #    '$status $body_bytes_sent "$http_referer" '
  #    '"$http_user_agent" $http_x_forwarded_for';
  access_log  /var/log/nginx/web1-access.log;
   
  ## whbmemo:以下配置请勿随意改动 ##
  location ~* .*\.php($|/){
   include  fcgi.conf;
  }
  
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  {
    expires      30d;
  }

  location ~ .*\.(js|css)?$
  {
    expires      1h;
  }      
  } 


}
----------------结束------vi /etc/nginx/nginx.conf万能配置----------------------------------

----------------开始------vi /etc/nginx/fcgi.conf万能配置-----------------------------------
## whbmemo:所有的后置WEB服务器,配置一样
if ($request_filename ~* (.*)\.php) {
            set $php_url $1;
      }
      if (!-e $php_url.php) {
            return 403;
      }


fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;

set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
        set $real_script_name $1;
        set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
## 以上是支持pathinfo的重点部分
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

#fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
#fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;
----------------结束------vi /etc/nginx/fcgi.conf万能配置-----------------------------------

[root@localhost ]# vi /mnt/www/phpinfo.php
---------------------开始----------------------------------
<?php
    phpinfo();
?>
---------------------结束---------------------------------

配置PHP连接Mysql测试

[root@web www]# vi /mnt/www/sql.php
---------------------开始----------------------------------
<?php
        $conn=mysql_connect('127.0.0.1','root','123654');
        if ($conn)
                echo "Success";
        else
                echo "Failure";
?>
--------------------结束----------------------------------
[root@localhost www]# rm -rf /etc/php.d && mkdir /etc/php.d
[root@localhost etc]# service php-fpm restart
[root@localhost www]# service nginx reload
 

################################################六安装vsftpd##################################################################
1:安装vsftpd
[root@localhost ~]#yum  install  vsftpd  #安装
[root@localhost ~]#chkconfig --levels 2345 vsftpd on  && chkconfig --list vsftpd && service vsftpd start
[root@localhost ~]#useradd -d /mnt/www -g ftp -s /sbin/nologin ftpuser   #增加用户  (WEB服务器)
[root@localhost ~]#passwd ftpuser               #设置密码
123654

2:其他配置(/etc/vsftpd/vsftpd.conf):
[root@localhost ~]#vi /etc/vsftpd.chroot_list   #增加用户ftpuser到这个文件
[root@localhost ~]#mkdir /mnt/logs && mkdir /mnt/logs/vsftpd
[root@localhost ~]# vi /mnt/logs/vsftpd/xferlog
[root@localhost ~]#ll /mnt/logs/vsftpd
[root@localhost ~]#vi /etc/vsftpd/user_list      #增加用户ftpuser到这个文件
[root@localhost ~]#chmod -R 777 /mnt/logs/vsftpd/xferlog  #赋权
[root@localhost ~]#chmod +x  /etc/vsftpd/vsftpd.conf
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf  #最后添加:
#禁止匿名账户登录
anonymous_enable=no
#限制访问上层目录
chroot_list_enable=yes
#登录FTP后被限制在家目录下的用户列表文件
chroot_list_file=/etc/vsftpd.chroot_list
#只允许:/etc/vsftpd/user_list下账户访问
userlist_deny=NO
#日志
xferlog_file=/mnt/logs/vsftpd/xferlog
#设置指令超时的时间
idle_session_timeout=600
#设置数据连接的超时时间
data_connection_timeout=120
#限制本地帐号的上传速度
#local_max_rate=5000
#欢迎信息
ftpd_banner=Landing has been recorded,unauthorized access forbidden.-getingbin
[root@localhost ~]# cd /root && service vsftpd restart 

################################################九:安装gd扩展模块:##################################################################
wget http://124.128.23.70:1436/linux/freetype-2.4.0.tar.bz2.tar http://124.128.23.70:1436/linux/jpegsrc.v9.tar.gz http://124.128.23.70:1436/linux/libpng-1.2.50.tar.gz
------------------
[root@localhost ~]# tar jxvf freetype-2.4.0.tar.bz2.tar
[root@localhost ~]# cd /root/freetype-2.4.0 && ./configure --prefix=/usr/local/freetype && make && make install

-----------------------------
[root@localhost ~]# cd /root && tar zxvf jpegsrc.v9.tar.gz && cd /root/jpeg-9
[root@localhost ~]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/jpeg && make && make install
[root@localhost ~]# mkdir -p /usr/local/jpeg/include && mkdir -p /usr/local/jpeg/lib && mkdir -p /usr/local/jpeg/bin && mkdir -p /usr/local/jpeg/man/man1
----------------
[root@localhost ~]#cd /root && tar zxvf libpng-1.2.50.tar.gz && cd /root/libpng-1.2.50
[root@localhost ~]#CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libpng && make && make install
----------------------------------------
[root@localhost ~]#cd /root/php-5.6.25/ext/gd
[root@localhost ~]#/usr/local/php/bin/phpize
[root@localhost ~]#./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype
[root@localhost ~]#make && make install
[root@localhost ~]#vi /etc/php.ini
#添加
extension=gd.so

[root@localhost ~]#/usr/local/php/bin/php -m
[root@localhost ~]#service php-fpm restart
[root@localhost ~]#service nginx restart

[root@localhost etc]# service php-fpm start
[root@localhost etc]# ps aux | grep php-fpm
[root@localhost etc]#killall php-fpm


################################################十:安装ZipArchive扩展模块:##################################################################
进入源码目录
[root@localhost zip]# cd /root/php-5.6.25/ext/zip
#运行phpize生成configure
[root@localhost zip]# /usr/local/php/bin/phpize
[root@localhost zip]#./configure --with-php-config=/usr/local/php/bin/php-config
#编译安装
[root@localhost ~]# make && make install
[root@localhost ~]ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
[root@localhost ~]#vi /etc/php.ini
#添加
extension=zip.so
[root@localhost ~]#/usr/local/php/bin/php -m
[root@localhost ~]#service php-fpm restart
[root@localhost ~]#service nginx restart
-----------------------------------十一:安装FTP模块---------------------------
进入源码目录
[root@localhost ftp]# cd /root/php-5.6.25/ext/ftp
#运行phpize生成configure
[root@localhost ftp]# /usr/local/php/bin/phpize
[root@localhost ftp]#./configure --with-php-config=/usr/local/php/bin/php-config
#编译安装
[root@localhost ~]# make && make install
[root@localhost ~]ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
[root@localhost ~]#vi /etc/php.ini
#添加
extension=ftp.so
[root@localhost ~]#/usr/local/php/bin/php -m
[root@localhost ~]#service php-fpm restart
[root@localhost ~]#service nginx restart
-----------------------------------安装FTP模块-结束--------------------------

-----------------------------------让nginx支持:apk ipa文件下载-------------------------

.apk 和 .ipa分别是android应用和ios应用的扩展名。
如果在浏览器下载这些文件为后缀的文件时,会自动重命名为zip文件。
当然可以下载后手动修改后缀,依然可以安装。
如果想下载后缀直接就是apk ipa的,可以修改 /usr/local/nginx/conf目录下的mime.types
增加如下配置,重启nginx生效

[root@localhost ~]#vi  /usr/local/nginx/conf/mime.types

application/vnd.android.package-archive apk;
application/iphone          pxl ipa;


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-BlogPHP 1.5.2 Zero

鲁ICP备19064028号 13658636711 getingbin@126.com