Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

部署在远程服务器 #13

Closed
D-MinGao opened this issue Jun 25, 2019 · 2 comments
Closed

部署在远程服务器 #13

D-MinGao opened this issue Jun 25, 2019 · 2 comments

Comments

@D-MinGao
Copy link

你好,
请问部署在远程服务器以后怎么打开后台呢?

@xiebruce
Copy link
Owner

xiebruce commented Jun 25, 2019

后台是一个网页,当然是通过域名打开了(说白了就是通过“网址”打开),网址是什么?你自己定呀。两种方法:

  1. 如果在本地部署,不是要修改hosts文件吗?所以你在hosts文件里写上:
127.0.0.1       api.picuploader.com

其中这意思就是告诉浏览器,api.picuploader.com这个“网址”对应的ip是“127.0.0.1”,也就是本机ip(为什么127.0.0.1是本机ip,这是规定的,任何电脑/手机上的127.0.0.1都表示本机)

而现在你部署到了服务器上,你服务器肯定有一个ip吧?假设你服务器ip是23.45.67.78,那么你只要把hosts文件改成下面这样就ok了:

23.45.67.78       api.picuploader.com

当然,api.picuploader.com是对应你服务器上nginx配置文件里的server_name


  1. 第1种方法需要你在每台要访问api.picuploader.com的电脑上都修改hosts文件并填上上述所说的内容,否则是打不开的。如果你不想这样,那就得注册一个域名,然后在域名注册服务商(比如阿里云)那里是可以指定你的域名对应的ip的,当然域名就不可能是api.picuploader.com了,比如你注册的域名是example.com,那你就添加一条www.example.com的记录,把它指向你服务器的ip23.45.67.78,并且你服务器的nginx配置文件的server_name值是www.example.com就行了。不过注册的域名是要认证也是要花钱的(每年都要交线)。

@D-MinGao
Copy link
Author

好的,谢谢大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants