• mg电子游戏腾博会/mg电子游戏腾博会【授权官网】

  • 发布时间:2016-01-20 01:19 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • mg电子游戏腾博会/mg电子游戏腾博会【授权官网】

    设置设备摆设Nginx虚拟主机:

    虚拟主机:

    [root@web-nginx ~]# cd/application/nginx/conf

    mg电子游戏腾博会/mg电子游戏腾博会【授权官网】

    [root@web-nginx conf]# cp nginx.conf /data/root/backup/备份nginx.conf设置设备摆设文件

    mg电子游戏腾博会/mg电子游戏腾博会【授权官网】

    [root@web-nginx conf]# egrep -v "#|^$" nginx.conf.default>nginx.conf

    将nginx.conf.default中没有注释、不是空缺行的内容导出到nginx.conf

    [root@web-nginx conf]# mkdir ../html/www

    [root@web-nginx conf]# mkdir ../html/bbs

    [root@web-nginx conf]# mkdir ../html/blog

    [root@web-nginx conf]# echo "www.etiantian.org" >../html/www/index.html

    [root@web-nginx conf]# echo "bbs.etiantian.org" >../html/bbs/index.html

    [root@web-nginx conf]# echo "blog.etiantian.org" >../html/blog/index.html

    [root@web-nginx conf]# cat ../html/{www,bbs,blog}/index.html

    www.etiantian.org

    bbs.etiantian.org

    blog.etiantian.org

    [root@web-nginx conf]# vim nginx.conf

    worker_processes1;

    events {

    worker_connections1024;

    }

    http {

    includemime.types;

    default_typeapplication/octet-stream;

    log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '

    '$status $body_bytes_sent "$http_referer" '

    '"$http_user_agent" "$http_x_forwarded_for"';

    access_loglogs/access.logmain;

    sendfileon;

    keepalive_timeout65;

    server {

    listen80;

    server_namewww.etiantian.org alias etiantian.org;

    access_log/app/logs/www_logs/access_www.logmain;

    location / {

    roothtml/www;

    indexindex.html index.htm;

    }

    error_page500 502 503 504/50x.html;

    location = /50x.html {

    roothtml;

    }

    }

    server {

    listen80;

    server_namebbs.etiantian.org;

    access_log/app/logs/bbs_logs/access_bbs.logmain;

    location / {

    roothtml/bbs;

    indexindex.html index.htm;

    }

    error_page500 502 503 504/50x.html;

    location = /50x.html {

    roothtml;

    }

    }

    server {

    listen80;

    server_nameblog.etiantian.org;

    access_log/app/logs/blog_logs/access_blog.logmain;

    location / {

    roothtml/blog;

    indexindex.html index.htm;

    }

    [root@web-nginx conf]# vim /etc/hosts

    192.168.10.104www.etiantian.orgetiantian.org

    192.168.10.104bbs.etiantian.orgblog.etiantian.org

    [root@webwww.tbplay918.con-nginx conf]# /application/nginx/sbin/nginx -t

    nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok

    nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful

    [root@web-nginx conf]# /application/nginx/sbin/nginx -s reload

    [root@web-nginx conf]# curl blog.etiantian.org

    blog.etiantian.org

    [root@web-nginx conf]# curl www.etiantian.org

    www.etiantian.org

    [root@web-nginx conf]# curl bbs.etiantian.org

    bbs.etiantian.org

    [root@web-nginx conf]# curl etiantian.org

    www.etiantian.org

    [root@web-nginx conf]# ll /app/logs/bbs_logs/

    total 4

    -rw-r--r--. 1 root root 183 Jul5 20:50 access_bbs.log

    [root@web-nginx conf]# ll /app/logs/blog_logs/

    total 4

    -rw-r--r--. 1 root root 183 Jul5 20:50 access_logs.log

    [root@web-nginx conf]# ll /app/logs/www_logs/

    total 4

    -rw-r--r--. 1 root root 366 Jul5 20:56 access_www.log

    这篇文章出自 “兰芷” 博客,请必须保存此出处http://.blog.51cto.com//

    建立nginx虚拟主机

    [root@web-nginx ~]# cat /etc/redhat-release反省体系版本号

    CentOS release 6.6 (Final)

    [root@web-nginx ~]# uname -r//printthekernel release

    2.6.32-504.el6.x86_64

    [root@web-nginx ~]# uname -m// print themachinehardware name

    x86_64

    [root@web-nginx ~]# rpm -qa gcc gcc-c++

    gcc-4.4.7-11.el6.x86_64

    gcc-c++-4.4.7-11.el6.x86_64

    [root@web-nginx ~]# rpm -qa pcre pcre-devel

    pcre-7.8-6.el6.x86_64

    [root@web-nginx ~]# yum -y install pcre pcre-devel装配pcre库(兼容正则表达式)

    [root@web-nginx ~]# rpm -qa openssl openssl-devel

    openssl-1.0.1e-30.el6.x86_64

    [root@web-nginx ~]# yum -y install openssl openssl-devel(安然的SSL协议传输http)

    [root@web-nginx ~]# rpm -qa pcre pcre-devel openssl openssl-devel

    pcre-7.8-6.el6.x86_64

    openssl-1.0.1e-30.el6.11.x86_64

    openssl-devel-1.0.1e-30.el6.11.x86_64

    pcre-devel-7.8-6.el6.x86_64

    [root@web-nginx nginx-1.6.3]# wget http://nginx.org/download/nginx-1.6.3.tar.gz下载装配包

    [root@web-nginx nginx-1.6.3]# ls承认装配包下载成功

    [root@web-nginx nginx-1.6.3]# tar -zxvf nginx-1.6.3.tar.gz解压

    [root@web-nginx nginx-1.6.3]# ls反省解压成果

    [root@web-nginx n亚洲网上娱乐ginx-1.6.3]# cd nginx-1.6.3

    [root@web-nginx nginx-1.6.3]# ./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module自定义装配设置设备摆设

    [root@web-nginx nginx-1.6.3]# make && make install编译装配

    [root@web-nginx nginx-1.6.3]# echo $?反省实行成果

    0成功

    [root@web-nginx nginx-1.6.3]# useradd nginx -s /sbin/nologin -M创立用户

    [root@web-nginx nginx-1.6.3]# id nginx反省用户和组信息

    uid=500(nginx) gid=500(nginx) groups=500(nginx)

    [root@web-nginx nginx-1.6.3]# ll /application/nginx-1.6.3/

    total 16

    drwxr-xr-x. 2 root root 4096 Jul5 15:43 conf设置设备摆设文件目录

    drwxr-xr-x. 2 root root 4096 Jul5 15:43 html站点目录

    drwxr-xr-x. 2 root root 4096 Jul5 15:43 logs日志文件目录

    drwxr-xr-x. 2 root root 4096 Jul5 15:43 sbin实行文件目录

    [root@web-nginx nginx-1.6.3]# ln -s /application/nginx-1.6.3/ /application/nginx为了方便应用,做软链接

    [root@web-nginx nginx-1.6.3]# ll /application/

    total 4

    lrwxrwxrwx. 1 root root25 Jul5 15:53 nginx -> /application/nginx-1.6.3/

    drwxr-xr-x. 6 root root 4096 Jul5 15:43 nginx-1.6.3

    [root@web-nginx nginx-1.6.3]# /application/nginx/sbin/nginx发动效劳

    [root@web-nginx nginx-1.6.3]# ps -ef |grep nginx |grep -v grep反省效劳进程

    root 15:55 ?00:00:00 nginx: master process /application/nginx/sbin/nginx主进程

    nginx 15:55 ?00:00:00 nginx: worker process功课进程

    [root@web-nginx nginx-1.6.3]# netstat -lntup |grep nginx端口是80

    tcp00 0.0.0.0:800.0.0.0:*LISTEN

    [root@web-nginx nginx-1.6.3]# curl 127.0.0.1测验本地

    浏览器登录测验成功

  • 相关内容

友情链接: