Spaces:
Sleeping
Sleeping
MZhao
commited on
Commit
•
83d5faf
1
Parent(s):
14740c0
新增nginx端口转发教程 (#50)
Browse files
README.md
CHANGED
@@ -123,6 +123,45 @@ demo.queue().launch(server_name="0.0.0.0", server_port=7860, share=False) # 可
|
|
123 |
demo.queue().launch(server_name="0.0.0.0", server_port=7860,auth=("在这里填写用户名", "在这里填写密码")) # 可设置用户名与密码
|
124 |
```
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
## 疑难杂症解决
|
127 |
|
128 |
|
|
|
123 |
demo.queue().launch(server_name="0.0.0.0", server_port=7860,auth=("在这里填写用户名", "在这里填写密码")) # 可设置用户名与密码
|
124 |
```
|
125 |
|
126 |
+
### 如果你想用域名访问,可以配置Nginx反向代理
|
127 |
+
|
128 |
+
添加独立配置文件:
|
129 |
+
```nginx
|
130 |
+
server {
|
131 |
+
listen 80;
|
132 |
+
server_name /域名/; # 请填入你设定的域名
|
133 |
+
access_log off;
|
134 |
+
error_log off;
|
135 |
+
location / {
|
136 |
+
proxy_pass http://127.0.0.1:7860; # 注意端口号
|
137 |
+
proxy_redirect off;
|
138 |
+
proxy_set_header Host $host;
|
139 |
+
proxy_set_header X-Real-IP $remote_addr;
|
140 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
141 |
+
proxy_max_temp_file_size 0;
|
142 |
+
client_max_body_size 10m;
|
143 |
+
client_body_buffer_size 128k;
|
144 |
+
proxy_connect_timeout 90;
|
145 |
+
proxy_send_timeout 90;
|
146 |
+
proxy_read_timeout 90;
|
147 |
+
proxy_buffer_size 4k;
|
148 |
+
proxy_buffers 4 32k;
|
149 |
+
proxy_busy_buffers_size 64k;
|
150 |
+
proxy_temp_file_write_size 64k;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
```
|
154 |
+
|
155 |
+
修改`nginx.conf`配置文件(通常在`/etc/nginx/nginx.conf`),向http部分添加如下配置:
|
156 |
+
(这一步是为了配置websocket连接,如之前配置过可忽略)
|
157 |
+
```nginx
|
158 |
+
map $http_upgrade $connection_upgrade {
|
159 |
+
default upgrade;
|
160 |
+
'' close;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
```
|
164 |
+
|
165 |
## 疑难杂症解决
|
166 |
|
167 |
|