Centos 7 部署Seafile+Nginx
我们之前简单部署了Seafile服务器,如今在Seafile的基础上使用Openssl+Nginx反向代理8000端口部署。
82 cd /usr/src@H_403_7@ 84 wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz@H_403_7@ 85 wget http://nginx.org/download/nginx-1.10.2.tar.gz@H_403_7@ 86 tar xzf Nginx-1.10.2.tar.gz && mv Nginx-1.10.2.tar.gz ~@H_403_7@ 87 tar xzf openssl-1.1.0c.tar.gz && mv openssl-1.1.0c.tar.gz ~
89 cd Nginx-1.10.2@H_403_7@ 90 ./configure --prefix=/etc/Nginx --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.pid --lock-path=/var/run/Nginx.lock --http-client-body-temp-path=/var/cache/Nginx/client_temp --http-proxy-temp-path=/var/cache/Nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/Nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/Nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/Nginx/scgi_temp --user=Nginx --group=Nginx --with-openssl=/usr/src/openssl-1.1.0c --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-ipv6
92 make && make install@H_403_7@ 94 useradd -s /sbin/nologin -M Nginx@H_403_7@ 95 mkdir -p /var/cache/Nginx/
98 openssl genrsa -out privkey.pem 2048@H_403_7@ 99 openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095/*按回车后可以随便填写内容*/
101 vi /etc/Nginx/Nginx.conf/*按回车后注释以下内容-并添加内容*/
/*注释内容如下*/
# server {@H_403_7@# listen 80;@H_403_7@# server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
# location / {@H_403_7@# root html;@H_403_7@# index index.html index.htm;@H_403_7@# }
# redirect server error pages to the static page /50x.html@H_403_7@ #@H_403_7@# error_page 500 502 503 504 /50x.html;@H_403_7@# location = /50x.html {@H_403_7@# root html;@H_403_7@# }
# proxy the PHP scripts to Apache listening on 127.0.0.1:80@H_403_7@ #@H_403_7@ #location ~ \.PHP$ {@H_403_7@ # proxy_pass http://127.0.0.1;@H_403_7@ #}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000@H_403_7@ #@H_403_7@ #location ~ \.PHP$ {@H_403_7@ # root html;@H_403_7@ # fastcgi_pass 127.0.0.1:9000;@H_403_7@ # fastcgi_index index.PHP;@H_403_7@ # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;@H_403_7@ # include fastcgi_params;@H_403_7@ #}
# deny access to .htaccess files,if Apache's document root@H_403_7@ # concurs with Nginx's one@H_403_7@ #@H_403_7@ #location ~ /\.ht {@H_403_7@ # deny all;@H_403_7@ #}@H_403_7@# }
server {@H_403_7@ listen 80;@H_403_7@ server_name seafile.abc.com;#自己的域名@H_403_7@ rewrite ^ https://$http_host$request_uri? permanent; #强制将http重定向到https@H_403_7@ }@H_403_7@ server {@H_403_7@ listen 443;@H_403_7@ ssl on;@H_403_7@ ssl_certificate /etc/ssl/cacert.pem; #cacert.pem 文件路径@H_403_7@ ssl_certificate_key /etc/ssl/privkey.pem; #privkey.pem 文件路径@H_403_7@ server_name seafile.abc.com;#自己的域名@H_403_7@ proxy_set_header X-Forwarded-For $remote_addr;@H_403_7@ location / {@H_403_7@ fastcgi_pass 127.0.0.1:8000;#端口号@H_403_7@ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;@H_403_7@ fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;@H_403_7@ fastcgi_param QUERY_STRING $query_string;@H_403_7@ fastcgi_param REQUEST_METHOD $request_method;@H_403_7@ fastcgi_param CONTENT_TYPE $content_type;@H_403_7@ fastcgi_param CONTENT_LENGTH $content_length;@H_403_7@ fastcgi_param SERVER_ADDR $server_addr;@H_403_7@ fastcgi_param SERVER_PORT $server_port;@H_403_7@ fastcgi_param SERVER_NAME $server_name;@H_403_7@ fastcgi_param HTTPS on;@H_403_7@ fastcgi_param HTTP_SCHEME https;
access_log /var/log/Nginx/seahub.access.log;@H_403_7@ error_log /var/log/Nginx/seahub.error.log;@H_403_7@ }@H_403_7@ location /seafhttp {@H_403_7@ rewrite ^/seafhttp(.*)$ $1 break;@H_403_7@ proxy_pass http://127.0.0.1:8082;@H_403_7@ client_max_body_size 0;@H_403_7@ proxy_connect_timeout 36000s;@H_403_7@ proxy_read_timeout 36000s;@H_403_7@ }@H_403_7@ location /media {@H_403_7@ root /home/cloud/seafile-server-latest/seahub;#seahub路径@H_403_7@ }@H_403_7@ }
123 Nginx -c /etc/Nginx/Nginx.conf@H_403_7@ 124 ./seafile.sh start@H_403_7@ 125 ./seahub.sh start-fastcgi
访问WEB:https://192.168.88.10//*如果提示404请重启服务器且执行123,124,125步骤*/
admin_User:abc@abc.com
psk:abc