項目部署

環境要求:
在linux系統中需要安裝配置以下環境 jdk,Tengine,redis,mysql,solr,tomcat
1.Tengine環境及配置
a)前端工程目錄:/data/itrip/itripfront
在這裏插入圖片描述
b)圖片目錄:
/data/itrip/uploadimg/comment 評論
/data/itrip/uploadimg/hotel 酒店
/data/itrip/uploadimg/hotelroom 酒店房間
在這裏插入圖片描述圖片在素材中有提供!!

c)配置文件nginx.conf,直接覆蓋掉原有的內容即可。

#user  nobody;
user  root;  # 裁剪圖片需要root權限
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;
}

# load modules compiled as Dynamic Shared Object (DSO)
#
#dso {
#    load ngx_http_fastcgi_module.so;
#    load ngx_http_rewrite_module.so;
#}

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;
		
		upstream itripbiz{
        server 127.0.0.1:8080;  
        server 127.0.0.1:8082;
    }
		
		server {
        listen       80;
        server_name  itrip.project.bdqn.cn;
				root   /data/itrip/itripfront;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        
				location /biz {
    				proxy_set_header Host $host:$server_port;
    				proxy_pass http://127.0.0.1:8080;
        }
        
        location /search {
    				proxy_set_header Host $host:$server_port;
    				proxy_pass http://127.0.0.1:8083;
        }
        
        location /auth {
    				proxy_set_header Host $host:$server_port;
    				proxy_pass http://127.0.0.1:8084;
        }
        
        location /trade {
        		proxy_set_header Host $host; 
          	proxy_set_header X-Real-IP $remote_addr;
    				proxy_pass http://127.0.0.1:8085;
        }
        
        
        
        

        #error_page  404              /404.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;
        #}
    }


    server {
        listen       80;
        server_name  img.itrip.project.bdqn.cn;
        root /data/itrip/uploadimg;

        location / {
             root /data/itrip/uploadimg; # 站點根目錄
             expires 1h;    # 緩存時間
             add_header Cache-Control max-age=3600; # 緩存時間
             access_log   /var/log/Tengine/host_access.log;
        }

        #如果 url 格式如:xxxx.gif_數字x數字.gif
        location ~* ^(.+\.(jpg|jpeg|gif|png))_(\d+)x(\d+)\.(jpg|jpeg|gif|png)$ {
           root /data/itrip/uploadimg;    #這裏必須設置,否則根目錄,即 $document_root 會是 Nginx 默認的 Nginx Root/html,在 Lua 中會得不到期望的值
           if (!-f $request_filename) { #如果文件不存在時才需要裁剪
              add_header X-Powered-By 'Lua GraphicsMagick';  #此HTTP Header無實際意義,用於測試
              add_header file-path $request_filename;  #此 HTTP Header無實際意義,用於測試
              lua_code_cache on;  #在編寫外部 Lua腳本時,設置爲off Nginx不會緩存 Lua,方便調試
              set $request_filepath /data/itrip/uploadimg$1;  #設置原始圖片路徑,如:/document_root/1.gif
              set $width $3;     # 設置裁剪/縮放的寬度
              set $height $4;    # 設置裁剪/縮放的高度
              set $ext $5;      # 圖片文件格式後綴
              content_by_lua_file /usr/local/Tengine/lua/ImageResizer.lua;  #加載外部 Lua 文件
            }
        }




        #charset koi8-r;

        #access_log  logs/host.access.log  main;

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



        #error_page  404              /404.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;
    #    }
    #}
}

d)至此在瀏覽器地址欄中輸入http://itrip.project.bdqn.cn。查看是否能夠訪問到靜態頁面。
輸入http://img.itrip.project.bdqn.cn/hotel/8-1556547356700-5678345.jpg
http://img.itrip.project.bdqn.cn/hotel/8-1556547356700-5678345.jpg_200x200.jpg 查看能否實現圖片及裁剪圖片
2.Redis
Redis按照視頻安裝配置即可
3.mysql
mysql按照視頻安裝即可,需要按照素材創建數據庫及插入數據即可。
4.tomcat環境及配置
目前5個tomcat(多個tomcat的安裝請參照之前發的資料)
在這裏插入圖片描述
itrip-biz:
/usr/local/tomcats/apache-tomcat-7.0.57-1/webapps 端口:8080
itrip-search:
/usr/local/tomcats/apache-tomcat-7.0.57-2/webapps 端口:8081
itrip-auth:
/usr/local/tomcats/apache-tomcat-7.0.57-3/webapps 端口:8082
itrip-trade:
/usr/local/tomcats/apache-tomcat-7.0.57-4/webapps 端口:8083
solr:
/usr/local/tomcats/apache-tomcat-7.0.57-5/webapps 端口:8084

說明:以上四個模塊部署時的目錄名稱分別是biz ,search,auth及trade
可以啓動每一個tomcat後測試能否訪問。

5.solr環境及配置
a)首先拷貝solr_home(針對酒店的配置模塊)至/data/itrip目錄
在這裏插入圖片描述
b)tomcat的lib目錄中需要加入以下jar包
在這裏插入圖片描述c)將solr拷貝至該tomcat的webapps目錄下
在這裏插入圖片描述
d)修改solr的WEB-INF下的web.xml文件,將solr_home的地址修改爲/data/itrip/solr_home
在這裏插入圖片描述e)至此可以地址欄輸入url: http://ip:端口/solr 查看能否導入數據到solr。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章