乐优商城(四十)—— 配置单

目录

一、虚拟机

1.1 Elasticsearch

1.2 分布式文件系统FastDFS

1.3 Nginx

1.4 Rabbitmq

1.5 Redis

二、主机

2.1 Nginx

2.2 host


一、虚拟机

1.1 Elasticsearch

配置:安装Elasticsearch

启动:

进入bin目录,执行:./elasticsearch

效果:

1.2 分布式文件系统FastDFS

配置:安装FastDFS

启动:

sudo service fdfs_trackerd start
sudo service fdfs_storaged start

效果:

1.3 Nginx

配置

静态图片放在images里面


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  66;

    gzip  on;

    server {
        listen       80;
  	server_name image.leyou.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
	location ~/group([0-9])/M00 {
		root /leyou/fdsf/storage_data/data;
		ngx_fastdfs_module;
	}

        location / {
            root   /leyou/static/;
        }

        #error_page  404              /407.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

启动:

1.4 Rabbitmq

配置:Rabbitmq安装

启动:service rabbitmq-server start

效果:

1.5 Redis

配置:Redis安装

启动:/etc/init.d/redis start

效果:

1.6 shell文件

#!/bin/sh

echo "------------------------FastDFS trackerd------------------"
sudo service fdfs_trackerd start


echo "------------------------FastDFS storaged------------------"
sudo service fdfs_storaged start

echo "==========================nginx==========================="
nginx

echo "========================rabbitmq=========================="
service rabbitmq-server start


echo "----------------------redis----------------"
/etc/init.d/redis start


echo "=======================elasticsearch========================"
cd /home/liyuanjun/leyou/elasticsearch/bin
./elasticsearch

二、主机

2.1 Nginx

配置:


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;

	server {
        listen       80;
        server_name  manage.leyou.com;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location / {
			proxy_pass http://127.0.0.1:9001;
			proxy_connect_timeout 1000;
			proxy_read_timeout 1000;
        }
    }

    server {
        listen       80;
        server_name  api.leyou.com;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;

        location /api/upload {
			proxy_pass http://127.0.0.1:8082;
			proxy_connect_timeout 1000;
			proxy_read_timeout 1000;
            rewrite "^/api/(.*)$" /$1 break; 
        }

        location / {
			proxy_pass http://127.0.0.1:10010;
			proxy_connect_timeout 1000;
			proxy_read_timeout 1000;
        }
    }
    server {
        listen       80;
        server_name  www.leyou.com;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location /item {

            #先找本地
            root html;
            if (!-f $request_filename){ #请求的文件不存在,就反向代理
                proxy_pass http://127.0.0.1:8084;
                break;
            }
			proxy_connect_timeout 600;
			proxy_read_timeout 600;
        }

        location / {
			proxy_pass http://127.0.0.1:9002;
			proxy_connect_timeout 600;
			proxy_read_timeout 600;
        }
    }

}

2.2 host

  • 3
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值