mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 04:01:58 +00:00
attempt to fix tor/lan urls for main ui
This commit is contained in:
committed by
Aiden McClelland
parent
f7556b78c5
commit
0f0403e8d7
@@ -3,6 +3,7 @@ use std::time::Duration;
|
||||
use color_eyre::eyre::eyre;
|
||||
use embassy::context::{DiagnosticContext, RpcContext};
|
||||
use embassy::db::subscribe;
|
||||
use embassy::hostname::get_hostname;
|
||||
use embassy::middleware::auth::auth;
|
||||
use embassy::middleware::cors::cors;
|
||||
use embassy::middleware::diagnostic::diagnostic;
|
||||
@@ -66,10 +67,17 @@ async fn inner_main(cfg_path: Option<&str>) -> Result<Option<Shutdown>, Error> {
|
||||
.expect("send shutdown signal");
|
||||
});
|
||||
|
||||
tokio::fs::write(
|
||||
"/etc/nginx/sites-available/default",
|
||||
include_str!("../nginx/main-ui.conf"),
|
||||
)
|
||||
tokio::fs::write("/etc/nginx/sites-available/default", {
|
||||
let info = embassy::db::DatabaseModel::new()
|
||||
.server_info()
|
||||
.get(&mut rpc_ctx.db.handle(), true)
|
||||
.await?;
|
||||
format!(
|
||||
include_str!("../nginx/main-ui.conf.template"),
|
||||
lan_hostname = info.lan_address.host_str().unwrap(),
|
||||
tor_hostname = info.tor_address.host_str().unwrap()
|
||||
)
|
||||
})
|
||||
.await
|
||||
.with_ctx(|_| {
|
||||
(
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
server {
|
||||
listen 443 ssl default_server;
|
||||
listen [::]:443 ssl default_server;
|
||||
ssl_certificate /etc/nginx/ssl/embassy_main.cert.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/embassy_main.key.pem;
|
||||
|
||||
root /var/www/html/main;
|
||||
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
server_name _;
|
||||
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
proxy_socket_keepalive on;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 1800;
|
||||
|
||||
location /rpc/ {
|
||||
proxy_pass http://127.0.0.1:5959/;
|
||||
}
|
||||
|
||||
location /ws/ {
|
||||
proxy_pass http://127.0.0.1:5960/;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
|
||||
location /marketplace/ {
|
||||
proxy_pass https://beta-registry-0-3.start9labs.com/; # TODO
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
84
appmgr/src/nginx/main-ui.conf.template
Normal file
84
appmgr/src/nginx/main-ui.conf.template
Normal file
@@ -0,0 +1,84 @@
|
||||
server {{
|
||||
listen 443 ssl default_server;
|
||||
listen [::]:443 ssl default_server;
|
||||
ssl_certificate /etc/nginx/ssl/embassy_main.cert.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/embassy_main.key.pem;
|
||||
|
||||
root /var/www/html/main;
|
||||
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
server_name {lan_hostname};
|
||||
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
proxy_socket_keepalive on;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 1800;
|
||||
|
||||
location /rpc/ {{
|
||||
proxy_pass http://127.0.0.1:5959/;
|
||||
}}
|
||||
|
||||
location /ws/ {{
|
||||
proxy_pass http://127.0.0.1:5960/;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}}
|
||||
|
||||
location /marketplace/ {{
|
||||
proxy_pass https://beta-registry-0-3.start9labs.com/; # TODO
|
||||
}}
|
||||
|
||||
location / {{
|
||||
try_files $uri $uri/ =404;
|
||||
}}
|
||||
}}
|
||||
server {{
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name {lan_hostname};
|
||||
return 301 https://$host$request_uri;
|
||||
}}
|
||||
server {{
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
ssl_certificate /etc/nginx/ssl/embassy_main.cert.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/embassy_main.key.pem;
|
||||
|
||||
root /var/www/html/main;
|
||||
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
server_name {tor_hostname};
|
||||
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
proxy_socket_keepalive on;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 1800;
|
||||
|
||||
location /rpc/ {{
|
||||
proxy_pass http://127.0.0.1:5959/;
|
||||
}}
|
||||
|
||||
location /ws/ {{
|
||||
proxy_pass http://127.0.0.1:5960/;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}}
|
||||
|
||||
location /marketplace/ {{
|
||||
proxy_pass https://beta-registry-0-3.start9labs.com/; # TODO
|
||||
}}
|
||||
|
||||
location / {{
|
||||
try_files $uri $uri/ =404;
|
||||
}}
|
||||
}}
|
||||
server {{
|
||||
listen 443 ssl;
|
||||
listen [::]:443;
|
||||
server_name {tor_hostname};
|
||||
return 301 http://$host$request_uri;
|
||||
}}
|
||||
Reference in New Issue
Block a user