memos icon indicating copy to clipboard operation
memos copied to clipboard

Change basepath + port of running docker container to use HTTPS

Open misteu opened this issue 3 years ago • 7 comments

Is your feature request related to a problem?

Hello,

I really love the project so far! It was really easy to setup and works great ❤️

I do not have much experience regarding Docker. I got memos running by using the command in your documentation: docker run -d --name memos -p 5230:5230 -v ~/.memos/:/var/opt/memos neosmemo/memos:latest

Describe the solution you'd like

Using that, memos is accessible via http://mydomain:5320. However, I want to use serve it under something like https://mydomain/memos (i.e. https://mydomain/memos:443).

Is this possible somehow without rebuilding the container?

I saw that there are config files in /var/lib/docker/containers/ but I have no idea what to change there to make that happen (or if that's even possible there)

Additional context

No response

misteu avatar Dec 09 '22 21:12 misteu

try

docker run -d --name memos -p 443:5230 -v ~/.memos/:/var/opt/memos neosmemo/memos:latest

hyoban avatar Dec 10 '22 00:12 hyoban

The best way is to enable HTTPS by nginx.

boojack avatar Dec 10 '22 02:12 boojack

try

docker run -d --name memos -p 443:5230 -v ~/.memos/:/var/opt/memos neosmemo/memos:latest

But then we cannot have other applications on that port. We would need a simple reverse-proxy, I guess!

TheNomad11 avatar Dec 10 '22 10:12 TheNomad11

try

docker run -d --name memos -p 443:5230 -v ~/.memos/:/var/opt/memos neosmemo/memos:latest

But then we cannot have other applications on that port. We would need a simple reverse-proxy, I guess!

Exactly, I run my blog there as well. Therefore, I would need another base path/reroute (however it's called).

I am aware that I can probably reroute it somehow via my webserver but I do not really want to mess too much around there.

misteu avatar Dec 10 '22 12:12 misteu

I just experimented, it seems the most basic version works:

server {
 listen 80;
 listen [::]:80;
 server_name yourmemosdomain.com;
  location / {
     proxy_pass http://localhost:5230/;
 }
}

and for apache

<VirtualHost *:80>
    ServerName memos.com
    AllowEncodedSlashes On
    ProxyPreserveHost On
    ProxyPass "/"  "http://localhost:5230/"
</VirtualHost>

TheNomad11 avatar Dec 10 '22 12:12 TheNomad11

I just experimented, it seems the most basic version works:


server {

 listen 80;

 listen [::]:80;

 server_name yourmemosdomain.com;

  location / {

     proxy_pass http://localhost:5230/;

 }

}



and for apache


<VirtualHost *:80>

    ServerName memos.com

    AllowEncodedSlashes On

    ProxyPreserveHost On

    ProxyPass "/"  "http://localhost:5230/"

</VirtualHost>

Nice, thanks! I will try that later 🙂

misteu avatar Dec 10 '22 16:12 misteu

ok, lol I ended up creating a directory called memo inside of my /var/www. In that I added an .htaccess with a redirect.

RewriteEngine On
RewriteRule ^ http://mydomain.com:5230/ [L,R=301]

Now I can access memos via: mydomain.com/memo

First, I wanted to have a subdomain for it, but my certificate does not support that.

fiddling around with the apache settings did not work for me. Maybe because my server setup is a little strange in another place 😄

misteu avatar Dec 10 '22 21:12 misteu

I'm fine with the setup right now :) Thanks all!

misteu avatar Dec 17 '22 08:12 misteu