• 搭建独立域名博客 -- 独立域名博客上线了 www.hanshuliang.com


    博客是安装在阿里云的服务器上.

    小结

    -- 进入数据库命令 :mysql -uroot -p123456 ;

    -- 检查nginx配置语法 :.../nginx/sbin/nginx -t;

    -- 重启nginx服务 :.../nginx/sbin/nginx -s reload ;


    phpwind地址http://115.28.42.124/

    wordpress博客地址http://115.28.42.124:8085/

    emlog博客地址http://115.28.42.124:8086/


    .

    作者 :万境绝尘

    转载请注明出处 http://blog.csdn.net/shulianghan/article/details/19175147

    .


    一 linu服务器搭建Apache/nginx+mysql+php环境


    .

    1. 下载一键安装包


    下载环境的一键安装包 : http://soft.phpwind.me/web/shubuntu1205.zip


    2. 上传一键安装包


    上传小文件直接在SecureCRT中使用 lrzsz 工具即可, 如果没有该工具, 使用yum install -y lrzsz命令进行安装;


    安装 lrzsz 工具使用 yum install -y lrzsz 命令;

    [root@ip28 han]# yum install lrzsz
    Excluding Packages in global exclude list
    Finished
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package lrzsz.x86_64 0:0.12.20-22.1 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved

    上传文件 : 进入要上传的文件目录, 使用 rz 命令, 会弹出一个窗口选择所要上传的文件;



    将一键安装包上传到 /data/work/php/han 目录中 : 随便安装在其它目录中也可以;



    3. 安装一键安装包


    解压一键安装包 : 在安装包目录中使用unzip shubuntu1205.zip 命令, 解压安装包, 会解压出一个 sh 目录;

    [root@ip28 han]# unzip shubuntu1205.zip 
    Archive:  shubuntu1205.zip
       creating: sh/
      inflating: sh/account.log          
       creating: sh/apt_ftp/
    
    ... ...
    
      inflating: sh/sphinxc.sh           
      inflating: sh/split_nginx_log.sh   
      inflating: sh/-txt         
    [root@ip28 han]# ls
    sh  shubuntu1205.zip

    文件权限 : 注意sh目录中的脚本都没有执行权限, 这里我们直接将 sh 目录下的所有文件都添加执行权限;

    -- 添加权限命令 : -R参数会递归子目录添加权限, 如果没有 -R 参数, 就只会给sh 这个目录添加执行权限;

    chmod -R 755 sh


    安装环境 : 进入 sh 目录中, 执行 ./install.sh 命令, 然后会让选择安装 apache 还是 nginx , 这里我们选择nginx;



    安装完成标志



    检查ngnix进程是否开启 : 使用命令ps -ef|grep nginx ;

    [root@ip28 sh]# ps -ef|grep nginx
    www      23672 27693  0 22:02 ?        00:00:00 nginx: worker process           
    www      23673 27693  0 22:02 ?        00:00:00 nginx: worker process           
    root     23721 32560  0 22:22 pts/0    00:00:00 grep nginx
    root     27693     1  0 21:53 ?        00:00:00 nginx: master process /alidata/server/nginx/sbin/nginx

    检查mysql程序是否开启 : 使用命令 ps -ef|grep mysql , 由打印出的日志可以得出下面的结论;

    -- mysql的安装目录 : /alidata/server/mysql/libexec/mysqld ;

    -- musql数据目录 : /alidata/server/mysql/var ;

    -- mysql用户 : mysql ;

    -- mysql错误日志目录 : /alidata/server/mysql/var/ip28.hichina.com.err ;

    [root@ip28 sh]# ps -ef|grep mysql
    root     23723 32560  0 22:25 pts/0    00:00:00 grep mysql
    root     25284     1  0 21:52 pts/0    00:00:00 /bin/sh /alidata/server/mysql/bin/mysqld_safe --datadir=/alidata/server/mysql/var --pid-file=/alidata/server/mysql/var/ip28.hichina.com.pid
    mysql    25453 25284  0 21:52 pts/0    00:00:00 /alidata/server/mysql/libexec/mysqld --basedir=/alidata/server/mysql --datadir=/alidata/server/mysql/var --user=mysql --log-error=/alidata/server/mysql/var/ip28.hichina.com.err --open-files-limit=16384 --pid-file=/alidata/server/mysql/var/ip28.hichina.com.pid --socket=/tmp/mysql.sock --port=3306

    .

    4. 登陆mysql


    查看账户信息 : 在sh目录中, 使用 cat account.log 查看账户信息, 

    [root@ip28 sh]# cat account.log
    ##########################################################################
    # 
    # thank you for using aliyun virtual machine
    # 
    ##########################################################################
    
    FTP:
    account:*******
    password:*******
    
    MySQL:
    account:root
    password:*******

    登陆数据库 : 使用命令 mysql -P3306 -uroot -p******* 登陆数据库;

    [root@ip28 sh]# mysql -P3306 -uroot -p*******
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 3
    Server version: 5.1.63-log Source distribution
    
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> 

    查看数据库 : 使用命令 show databases; 查看数据库;

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema | 
    | mysql              | 
    | test               | 
    +--------------------+
    3 rows in set (0.04 sec)

    使用mysql数据库 : 使用命令 use mysql;

    mysql> use mysql;
    Database changed


    查看mysql表 : 使用命令 show tables;;

    mysql> show tables;
    +---------------------------+
    | Tables_in_mysql           |
    +---------------------------+
    | columns_priv              | 
    | db                        | 
    | event                     | 
    | func                      | 
    | general_log               | 
    | help_category             | 
    | help_keyword              | 
    | help_relation             | 
    | help_topic                | 
    | host                      | 
    | ndb_binlog_index          | 
    | plugin                    | 
    | proc                      | 
    | procs_priv                | 
    | servers                   | 
    | slow_log                  | 
    | tables_priv               | 
    | time_zone                 | 
    | time_zone_leap_second     | 
    | time_zone_name            | 
    | time_zone_transition      | 
    | time_zone_transition_type | 
    | user                      | 
    +---------------------------+
    23 rows in set (0.01 sec)

    查询user表字段使用命令desc user; ;

    mysql> desc user;
    +-----------------------+-----------------------------------+------+-----+---------+-------+
    | Field                 | Type                              | Null | Key | Default | Extra |
    +-----------------------+-----------------------------------+------+-----+---------+-------+
    | Host                  | char(60)                          | NO   | PRI |         |       | 
    | User                  | char(16)                          | NO   | PRI |         |       | 
    | Password              | char(41)                          | NO   |     |         |       | 
    | Select_priv           | enum('N','Y')                     | NO   |     | N       |       | 
    | Insert_priv           | enum('N','Y')                     | NO   |     | N       |       | 
    | Update_priv           | enum('N','Y')                     | NO   |     | N       |       | 
    | Delete_priv           | enum('N','Y')                     | NO   |     | N       |       | 
    | Create_priv           | enum('N','Y')                     | NO   |     | N       |       | 
    | Drop_priv             | enum('N','Y')                     | NO   |     | N       |       | 
    | Reload_priv           | enum('N','Y')                     | NO   |     | N       |       | 
    | Shutdown_priv         | enum('N','Y')                     | NO   |     | N       |       | 
    | Process_priv          | enum('N','Y')                     | NO   |     | N       |       | 
    | File_priv             | enum('N','Y')                     | NO   |     | N       |       | 
    | Grant_priv            | enum('N','Y')                     | NO   |     | N       |       | 
    | References_priv       | enum('N','Y')                     | NO   |     | N       |       | 
    | Index_priv            | enum('N','Y')                     | NO   |     | N       |       | 
    | Alter_priv            | enum('N','Y')                     | NO   |     | N       |       | 
    | Show_db_priv          | enum('N','Y')                     | NO   |     | N       |       | 
    | Super_priv            | enum('N','Y')                     | NO   |     | N       |       | 
    | Create_tmp_table_priv | enum('N','Y')                     | NO   |     | N       |       | 
    | Lock_tables_priv      | enum('N','Y')                     | NO   |     | N       |       | 
    | Execute_priv          | enum('N','Y')                     | NO   |     | N       |       | 
    | Repl_slave_priv       | enum('N','Y')                     | NO   |     | N       |       | 
    | Repl_client_priv      | enum('N','Y')                     | NO   |     | N       |       | 
    | Create_view_priv      | enum('N','Y')                     | NO   |     | N       |       | 
    | Show_view_priv        | enum('N','Y')                     | NO   |     | N       |       | 
    | Create_routine_priv   | enum('N','Y')                     | NO   |     | N       |       | 
    | Alter_routine_priv    | enum('N','Y')                     | NO   |     | N       |       | 
    | Create_user_priv      | enum('N','Y')                     | NO   |     | N       |       | 
    | Event_priv            | enum('N','Y')                     | NO   |     | N       |       | 
    | Trigger_priv          | enum('N','Y')                     | NO   |     | N       |       | 
    | ssl_type              | enum('','ANY','X509','SPECIFIED') | NO   |     |         |       | 
    | ssl_cipher            | blob                              | NO   |     | NULL    |       | 
    | x509_issuer           | blob                              | NO   |     | NULL    |       | 
    | x509_subject          | blob                              | NO   |     | NULL    |       | 
    | max_questions         | int(11) unsigned                  | NO   |     | 0       |       | 
    | max_updates           | int(11) unsigned                  | NO   |     | 0       |       | 
    | max_connections       | int(11) unsigned                  | NO   |     | 0       |       | 
    | max_user_connections  | int(11) unsigned                  | NO   |     | 0       |       | 
    +-----------------------+-----------------------------------+------+-----+---------+-------+
    39 rows in set (0.01 sec)

    查询user表中root用户信息使用命令select Host,User,Password from user;;

    mysql> select Host,User,Password from user;   
    +-----------+------+-------------------------------------------+
    | Host      | User | Password                                  |
    +-----------+------+-------------------------------------------+
    | localhost | root | *CE20A064267096B8D3F8B0EC068FE253144546F6 | 
    +-----------+------+-------------------------------------------+
    1 row in set (0.01 sec)

    修改root用户登陆端口使用命update user set Host='%' where Host='localhost';  ;

    mysql> update user set Host='%' where Host='localhost'; 
    Query OK, 1 row affected (0.02 sec)
    Rows matched: 1  Changed: 1  Warnings: 0

    刷新权限使用命令flush privileges ;

    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> exit
    Bye



    5. 安装phpWind

    .


    进入phpWind安装界面 : 在浏览器中输入服务器的ip地址, 安装 phpwind , 服务器的ip地址为 : 115.28.42.124, 会进入phpWind的安装界面;



    检查安装环境 : 没有错误, 进入下一步;





    设置一系列的参数

    -- 数据库服务器 : 这里数据库和phpWind都是在这个服务器上, 因此填写 localhost;

    -- 数据库类型 : 选择MySQL;

    -- 数据库用户名 : root;

    -- 数据库密码 : 在sh目录中, 使用 cat account.log 命令获取;

    -- 数据库名 : phpWind会自动创建这个数据库;

    -- 数据库表前缀 : 数据库中所有的表的命名;


    -- 创始人信息 : 这个是网站的超级管理员密码;


    .


    创建数据库和表



    进入phpwind网站 :



    二. Nginx下添加网站


    1. 分析配置文件


    Nginx安装目录 : /alidata/server/nginx/conf/vhosts ;

    [root@ip28 ~]# cd /alidata/
    [root@ip28 alidata]# ls
    android  android-new  log  server  www
    [root@ip28 alidata]# cd server/
    [root@ip28 server]# ls
    mysql  mysql-5.1.57  nginx  nginx-1.0.4  php  php-5.2.17  Zend
    [root@ip28 server]# cd nginx
    [root@ip28 nginx]# ls
    client_body_temp  conf  fastcgi_temp  html  logs  proxy_temp  sbin  scgi_temp  uwsgi_temp
    [root@ip28 nginx]# cd conf/
    [root@ip28 conf]# ls
    fastcgi.conf          fastcgi_params.default  mime.types          nginx.conf.default  scgi_params.default   vhosts
    fastcgi.conf.default  koi-utf                 mime.types.default  rewrite             uwsgi_params          win-utf
    fastcgi_params        koi-win                 nginx.conf          scgi_params         uwsgi_params.default

    网站配置目录 : 在 /alidata/server/nginx/conf/vhosts 目录下, 网站的配置信息存放在这个目录中;

    [root@ip28 vhosts]# ls
    default.conf.bak  phpwind.conf

    分析配置文件内容 :

    --端口 : listen , 80是默认端口, 网站肯定要使用这个端口, 否则输入域名之后还要输出端口号, 用户体验不好;

    --登陆域名 : server_name , 这里的域名是 localhost, 直接使用 115.28.42.124 域名即可登陆;

    --网站文件存放目录 : root 后面的是网站文件存放目录;

    --日志输出文件 : access_log ;

    [root@ip28 vhosts]# cat phpwind.conf 
    server {
            listen       80;
            server_name  localhost;
            index index.html index.htm index.php;
            root /alidata/www/phpwind;
            location ~ .*.(php|php5)?$
            {
                    #fastcgi_pass  unix:/tmp/php-cgi.sock;
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    include fastcgi.conf;
            }
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                    expires 30d;
            }
            location ~ .*.(js|css)?$
            {
                    expires 1h;
            }
            #α
    
                    include /alidata/server/nginx/conf/rewrite/phpwind.conf;
            access_log  /alidata/log/nginx/access/phpwind.log;
    }

    .


    2. 为单个网站添加多个域名


    为单个网站添加多个域名, 只需要将server{} 在同一文件中拷贝一份, 然后将登陆域名修改下即可

    server {
            listen       80;
            server_name  localhost;
            index index.html index.htm index.php;
            root /alidata/www/phpwind;
            location ~ .*.(php|php5)?$
            {
                    #fastcgi_pass  unix:/tmp/php-cgi.sock;
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    include fastcgi.conf;
            }
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                    expires 30d;
            }
            location ~ .*.(js|css)?$
            {
                    expires 1h;
            }
            #α
    
                    include /alidata/server/nginx/conf/rewrite/phpwind.conf;
            access_log  /alidata/log/nginx/access/phpwind.log;
    }
    server {
            listen       8081;
            server_name  localhost;
            index index.html index.htm index.php;
            root /alidata/www/phpwind;
            location ~ .*.(php|php5)?$
            {
                    #fastcgi_pass  unix:/tmp/php-cgi.sock;
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    include fastcgi.conf;
            }
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                    expires 30d;
            }
            location ~ .*.(js|css)?$
            {
                    expires 1h;
            }
            #α
    
                    include /alidata/server/nginx/conf/rewrite/phpwind.conf;
            access_log  /alidata/log/nginx/access/phpwind.log;
    }

    进行验证

    -- 使用ip地址登陆 : 浏览器中输入 115.28.42.124 成功进入网站;

    -- 使用ip地址+端口号登陆: 浏览器中输入 115.28.42.124:8081 成功进入网站 ;

      


    .

    3. 修改配置文件


    拷贝配置文件 : 在vhost 目录下有两个配置文件 default.conf.bak  phpwind.conf, 这里拷贝一份 default.conf.bak 文件;

    --拷贝命令 : 使用命令 cp default.conf.bak aliyun-test.conf 拷贝文件, 拷贝 default.conf.bak 文件 并改名为 aliyun-text.conf;

    [root@ip28 vhosts]# ls
    default.conf.bak  phpwind.conf
    [root@ip28 vhosts]# cp default.conf.bak aliyun-test.conf
    [root@ip28 vhosts]# ls
    aliyun-test.conf  default.conf.bak  phpwind.conf


    修改配置文件

    --修改端口号 : listen 8082;

    --修改登陆域名 : 我的域名还没通过备案, 先用这个server_name localhost ;

    --修改网站文件位置 : root /alidata/www/aliyun-test ;

    --修改日志文件位置 : access_log  /alidata/log/nginx/access/default.log aliyun-test;

    修改后的文件

    server {
            listen       8082;
            server_name  localhost;
            index index.html index.htm index.php;
            root /alidata/www/aliyun-test;
            location ~ .*.(php|php5)?$
            {
                    #fastcgi_pass  unix:/tmp/php-cgi.sock;
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    include fastcgi.conf;
            }
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                    expires 30d;
            }
            location ~ .*.(js|css)?$
            {
                    expires 1h;
            }
            #α
    
                    include /alidata/server/nginx/conf/rewrite/default.conf;
            access_log  /alidata/log/nginx/access/aliyun-test.log;
    }


    检查语法错误 : 使用命令 /alidata/server/nginx/sbin/nginx -t检查语法错误;

    [root@ip28 vhosts]# /alidata/server/nginx/sbin/nginx -t
    nginx: the configuration file /alidata/server/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /alidata/server/nginx/conf/nginx.conf test is successful


    重启nginx服务器 : 使用命令 /alidata/server/nginx/sbin/nginx -s reload ;


    登陆网站 : 使用 115.28.42.124:8082 登陆网站, 会出现404错误;

    --错误原因 : 在 /alidata/www 下没有对应网站目录;



    创建网站目录 : 使用命令mkdir /alidata/www/aliyun-test , 之后继续访问网站;


    访问网站出现403错误: 这是因为创建的目录没有权限;



    查看权限 : 使用 ll 命令即可, nginx 服务器用户是 www , aliyun-test目录的所有者是 root, 因此不能访问;



    添加权限 : 使用命令 chown -R www:www /alidata/www/aliyun-test/ 为aliyun-test添加所有者;

    [root@ip28 www]# chown -R www:www /alidata/www/aliyun-test/   
    [root@ip28 www]# ll
    total 8
    drwxr-xr-x  2 www www 4096 Feb 17 23:58 aliyun-test
    drwxr-xr-x 26 www www 4096 Feb 15 23:21 phpwind


    在目录下创建一个 index.html文件 : 写入 hanshuliang, 之后登陆

    [root@ip28 aliyun-test]# vim index.html
    [root@ip28 aliyun-test]# ls
    index.html
    [root@ip28 aliyun-test]# cat index.html 
    hanshuliang
    [root@ip28 aliyun-test]# 


    登陆网站 : 115.28.42.124:8082 , 登陆成功;




    三. 添加一个WordPress博客网站


    一定要按照步骤来, 一步也不能出错;


    进入网站目录获取WordPress安装程序 : 使用命令 wget http://cn.wordpress.org/wordpress-3.8.1-zh_CN.tar.gz 下载WordPress程序;

    [root@ip28 www]# wget http://cn.wordpress.org/wordpress-3.8.1-zh_CN.tar.gz
    --2014-02-18 14:24:38--  http://cn.wordpress.org/wordpress-3.8.1-zh_CN.tar.gz
    Resolving cn.wordpress.org... 66.155.40.250, 66.155.40.249
    Connecting to cn.wordpress.org|66.155.40.250|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 6283476 (6.0M) [application/octet-stream]
    Saving to: `wordpress-3.8.1-zh_CN.tar.gz'
    
    100%[========================================================================>] 6,283,476    280K/s   in 24s     
    
    2014-02-18 14:25:04 (261 KB/s) - `wordpress-3.8.1-zh_CN.tar.gz' saved [6283476/6283476]


    解压文件 : 使用命令 tar -xzvf wordpress-3.8.1-zh_CN.tar.gz 将下载的安装包解压;


    修改所有者权限 : 解压之后, nginx用户 www 没有对 wordpress 目录的访问权限, 这里需要添加文件所有者权限;

    -- 使用命令chown -R www:www wordpress 添加www:www用户组权限;

    [root@ip28 www]# ll
    total 11912
    drwxr-xr-x  2 www    www      4096 Feb 18 00:20 aliyun-test
    -rw-r--r--  1 root   root  5869727 Jan 24 04:18 latest.tar.gz
    drwxr-xr-x 26 www    www      4096 Feb 15 23:21 phpwind
    drwxr-xr-x  5 nobody 65534    4096 Jan 25 11:17 wordpress
    -rw-r--r--  1 root   root  6283476 Jan 25 11:17 wordpress-3.8.1-zh_CN.tar.gz
    [root@ip28 www]# chown -R www:www wordpress
    [root@ip28 www]# ll
    total 11912
    drwxr-xr-x  2 www  www     4096 Feb 18 00:20 aliyun-test
    -rw-r--r--  1 root root 5869727 Jan 24 04:18 latest.tar.gz
    drwxr-xr-x 26 www  www     4096 Feb 15 23:21 phpwind
    drwxr-xr-x  5 www  www     4096 Jan 25 11:17 wordpress
    -rw-r--r--  1 root root 6283476 Jan 25 11:17 wordpress-3.8.1-zh_CN.tar.gz

    创建数据库 : 使用 mysql -u用户名 -p密码 进入数据库, 使用SQL语句 create database han_wordpress; 创建名为 han_wordpress 的数据库;

    [root@ip28 www]# mysql -uroot -p******
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 299
    Server version: 5.1.63-log Source distribution
    
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> create database han_wordpress;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> exit
    Bye

    设置网站配置文件 : 配置文件的位置在 /alidata/server/nginx/conf/vhosts 目录下;
    [root@ip28 vhosts]# pwd
    /alidata/server/nginx/conf/vhosts
    [root@ip28 vhosts]# ls
    aliyun-test.conf  default.conf.bak  han-wordpress.conf  phpwind.conf

    配置文件内容

    [root@ip28 vhosts]# vim han-wordpress.conf 
    [root@ip28 vhosts]# cat han-wordpress.conf 
    server {
            listen       8085;
            server_name  localhost;
            index index.html index.htm index.php;
            root /alidata/www/wordpress;
            location ~ .*.(php|php5)?$
            {
                    #fastcgi_pass  unix:/tmp/php-cgi.sock;
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    include fastcgi.conf;
            }
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                    expires 30d;
            }
            location ~ .*.(js|css)?$
            {
                    expires 1h;
            }
            #α
    
                    include /alidata/server/nginx/conf/rewrite/default.conf;
            access_log  /alidata/log/nginx/access/han-wordpress.log;
    }

    进入网站 : 浏览器输入 115.28.42.124:8085 进入网站;




    创建配置文件



    开始安装




    安装完毕登陆网站 : 地址栏输入115.28.42.124:8085 即可访问;




    四. 安装emlog博客


    下载emlog博客程序 : 进入 /alidata/www/目录, 网站文件都放在这个目录中, 使用 wget http://www.emlog.net/em_download/emlog/emlog_5.2.1.zip 命令获取安装包;

    [root@ip28 www]# wget http://www.emlog.net/em_download/emlog/emlog_5.2.1.zip
    --2014-02-18 21:08:19--  http://www.emlog.net/em_download/emlog/emlog_5.2.1.zip
    Resolving www.emlog.net... 42.120.7.43
    Connecting to www.emlog.net|42.120.7.43|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 573038 (560K) [application/zip]
    Saving to: `emlog_5.2.1.zip'
    
    100%[========================================================================>] 573,038      124K/s   in 4.5s    
    
    2014-02-18 21:08:24 (124 KB/s) - `emlog_5.2.1.zip' saved [573038/573038]

    解压安装包 : 使用命令 unzip emlog_5.2.1.zip 解压安装包, 解压完之后网站文件都解压到了 emlog 目录中;


    修改目录权限 : emlog目录是在root用户下解压的, nginx 的 www用户和组没有访问该目录的权限;

    -- 设置权限 : 使用命令chown -R www:www emlog;

    [root@ip28 www]# ll
    total 12480
    drwxr-xr-x  2 www  www     4096 Feb 18 00:20 aliyun-test
    drwxr-xr-x  3 root root    4096 Dec  8 20:15 emlog
    -rw-r--r--  1 root root  573038 Dec  8 22:21 emlog_5.2.1.zip
    -rw-r--r--  1 root root 5869727 Jan 24 04:18 latest.tar.gz
    drwxr-xr-x 26 www  www     4096 Feb 15 23:21 phpwind
    drwxr-xr-x  5 www  www     4096 Feb 18 15:25 wordpress
    -rw-r--r--  1 root root 6283476 Jan 25 11:17 wordpress-3.8.1-zh_CN.tar.gz
    [root@ip28 www]# chown -R www:www emlog
    [root@ip28 www]# ll
    total 12480
    drwxr-xr-x  2 www  www     4096 Feb 18 00:20 aliyun-test
    drwxr-xr-x  3 www  www     4096 Dec  8 20:15 emlog
    -rw-r--r--  1 root root  573038 Dec  8 22:21 emlog_5.2.1.zip
    -rw-r--r--  1 root root 5869727 Jan 24 04:18 latest.tar.gz
    drwxr-xr-x 26 www  www     4096 Feb 15 23:21 phpwind
    drwxr-xr-x  5 www  www     4096 Feb 18 15:25 wordpress
    -rw-r--r--  1 root root 6283476 Jan 25 11:17 wordpress-3.8.1-zh_CN.tar.gz

    创建emlog博客的数据库 : 进入数据库 创建 han_emlog 数据库;

    [root@ip28 www]# mysql -uroot -p******
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 470
    Server version: 5.1.63-log Source distribution
    
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema | 
    | han_phpwind        | 
    | han_wordpress      | 
    | mysql              | 
    | test               | 
    +--------------------+
    5 rows in set (0.00 sec)
    
    mysql> create database han_emlog;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> exit
    Bye
    [root@ip28 www]# 

    在 /alidata/server/nginx/conf/vhosts 下创建 han-emlog.conf文件, 内容如下 : 主要修改端口号 和 目录位置 ,日志文件;

    -- 端口号 : listen 8086;

    -- 网站文件位置 : root /alidata/www/emlog/src, 网站文件里面竟然还有一层, 大坑;

    -- 日志文件位置 : access_log  /alidata/log/nginx/access/han-emlog.log;

    server {
            listen       8086;
            server_name  localhost;
            index index.html index.htm index.php;
            root /alidata/www/emlog/src;
            location ~ .*.(php|php5)?$
            {
                    #fastcgi_pass  unix:/tmp/php-cgi.sock;
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    include fastcgi.conf;
            }
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                    expires 30d;
            }
            location ~ .*.(js|css)?$
            {
                    expires 1h;
            }
            #α
    
                    include /alidata/server/nginx/conf/rewrite/default.conf;
            access_log  /alidata/log/nginx/access/han-emlog.log;
    }

    输入配置信息



    安装成功



    输入地址http://115.28.42.124:8086/ 依旧没有域名;




    域名备案还没通过, 这效率太慢了 , 一个月过去了 : 先用 ip地址 + 端口号访问;


    .

    作者 :万境绝尘

    转载请注明出处 http://blog.csdn.net/shulianghan/article/details/19175147

    .



  • 相关阅读:
    Docker-compose编排微服务顺序启动解决方案
    在笔记本上使用virtualbox搭建lvs dr 实验遇到的问题
    MongoDB安装配置(RedHat/CentOS)
    wget 用法
    Ubuntu查看crontab运行日志
    CentOS-6.5安装Zabbix 3.0.4
    centos 6 安装vsftpd与PAM虚拟用户
    python socket常用接口说明
    cmake 构建工程
    std::vector的下标访问和迭代器访问的效率
  • 原文地址:https://www.cnblogs.com/hanshuliang/p/4215439.html
Copyright © 2020-2023  润新知