安装nginx
可以看win10安装nginx的配置和使用方法(图文)_win10 nginx-CSDN博客
或nginx: downloadhttp://nginx.org/en/download.html
解压之后随便放
查看安装成功没
假设你安装在 C:\server\nginx-1.0.2目录下,
cmd命令进入安装文件;
启动:
C:\server\nginx-1.0.2>start nginx
停止
C:\server\nginx-1.0.2>nginx.exe -s stop
我首次安装的执行
C:\Users\Administrator\Desktop\nginx-1.24.0>start nginx
C:\Users\Administrator\Desktop\nginx-1.24.0> nginx -t
C:\Users\Administrator\Desktop\nginx-1.24.0> tasklist /fi "imagename eq nginx.exe"
C:\Users\Administrator\Desktop\nginx-1.24.0>nginx.exe -s stop
C:\Users\Administrator\Desktop\nginx-1.24.0>start nginx
我就可以使用了
如果出现错误可以查看error文件
安装成功的话显示(在浏览器执行localhost)
然后配置conf文件
修改一下公网ip和端口号就可以用
#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 {
server_names_hash_bucket_size 64; # 需要添加该项
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 tunnel {
server 127.0.0.1:8000;
}
server {
listen 80;
server_name xx.xxx.xx.xx;#这里填公网ip
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://tunnel;
}
location /seafhttp { # seafile服务的FILE_SERVER_ROOT设置项
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
proxy_request_buffering off;
}
location /media {
rewrite ^/media(.*)$ /media$1 break;
root C:\Users\Administrator\Desktop\seafile-server_5.0.3_win32\seafile-server-5.0.3\seahub;
}
#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;
# }
#}
}
主要是修改
这里不知道改不改有没有用
配置完毕
配置阿里云服务器
找到安全组
打开80端口
进入云服务器系统中
打开防火墙
写入俩规则(新建规则)
这里要英文逗号
配置完毕
配置seafile
ok