Link to a specific domain to a specific port : Nginx, Docker, Google cloud Service
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am trying to link a domain I purchased to my Google Cloud service, using docker a Nginx but, I have try so many solution write on Stackoverflow... but all failed.
What did I miss... Do you have any idea ?
There is my files
Environnement
Domain : Google domain
Server : Google Cloud Service / compute engine / Centos 7.0;
Container : Docker / Docker-compose / Nginx
Dockerfile
FROM nginx
WORKDIR /usr/share/nginx/html
COPY ./client/dist ./
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker-compose
app:
build:
context: .
dockerfile: ./Dockerfile
environment:
- NODE_ENV=prod
- PORT=8081
volumes:
- /usr/share/nginx/html
ports:
- "8081:80"
Nginx
server {
listen 80;
server_name example.net;
root /usr/share/nginx/html;
index index.html;
charset utf-8;
# enable gzip
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
location ~* ^.+.(ico|gif|jpg|jpeg|png)$ {
expires 30d;
}
location ~* ^.+.(css|js|txt|xml|swf|wav)$ {
expires 24h;
}
location ~* ^.+.(html|htm)$ {
expires 1h;
}
location ~* ^.+.(eot|ttf|otf|woff|svg)$ {
expires max;
}
location / {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
try_files $uri /index.html;
}
}
Google Cloud Firewall
Google Cloud Firewall Port Image
I have a domain I have purchased (ex. example.net) and I have an VueJs app running on port 8081.
My application is working on example.net:8081... But I want it running only on example.net... But nothing...
Hope some will find where I am making a mistake...
Thank you for reading
PS : There is some people who will tell me this is probably a duplicate post but... 1. I do not find any good anwser to this, I would not ask for help I would find it. 2. Don't be mean please).
docker nginx dns docker-compose google-compute-engine
|
show 2 more comments
I am trying to link a domain I purchased to my Google Cloud service, using docker a Nginx but, I have try so many solution write on Stackoverflow... but all failed.
What did I miss... Do you have any idea ?
There is my files
Environnement
Domain : Google domain
Server : Google Cloud Service / compute engine / Centos 7.0;
Container : Docker / Docker-compose / Nginx
Dockerfile
FROM nginx
WORKDIR /usr/share/nginx/html
COPY ./client/dist ./
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker-compose
app:
build:
context: .
dockerfile: ./Dockerfile
environment:
- NODE_ENV=prod
- PORT=8081
volumes:
- /usr/share/nginx/html
ports:
- "8081:80"
Nginx
server {
listen 80;
server_name example.net;
root /usr/share/nginx/html;
index index.html;
charset utf-8;
# enable gzip
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
location ~* ^.+.(ico|gif|jpg|jpeg|png)$ {
expires 30d;
}
location ~* ^.+.(css|js|txt|xml|swf|wav)$ {
expires 24h;
}
location ~* ^.+.(html|htm)$ {
expires 1h;
}
location ~* ^.+.(eot|ttf|otf|woff|svg)$ {
expires max;
}
location / {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
try_files $uri /index.html;
}
}
Google Cloud Firewall
Google Cloud Firewall Port Image
I have a domain I have purchased (ex. example.net) and I have an VueJs app running on port 8081.
My application is working on example.net:8081... But I want it running only on example.net... But nothing...
Hope some will find where I am making a mistake...
Thank you for reading
PS : There is some people who will tell me this is probably a duplicate post but... 1. I do not find any good anwser to this, I would not ask for help I would find it. 2. Don't be mean please).
docker nginx dns docker-compose google-compute-engine
8081:80
you current bind container port 80 to 8081 on your server machine. But you want access to your domain without port, right ? So, bind 80 port inside container to80
port on serrver by change8081:80
to80:80
. And make sure theris nothing use 80 port on real serve machine by commandsudo lsof -i tcp:80
– Truong Dang
Nov 27 '18 at 5:58
Thanks you very much ! I will try this !!
– Jérôme Dupuis
Nov 27 '18 at 6:58
@TruongDang Problem solved ! Thanks a lot!
– Jérôme Dupuis
Nov 27 '18 at 7:07
So happy when i can help you ^^
– Truong Dang
Nov 27 '18 at 7:18
@Truong Dang Please post it as an answer for community visibility
– Digil
Nov 27 '18 at 21:00
|
show 2 more comments
I am trying to link a domain I purchased to my Google Cloud service, using docker a Nginx but, I have try so many solution write on Stackoverflow... but all failed.
What did I miss... Do you have any idea ?
There is my files
Environnement
Domain : Google domain
Server : Google Cloud Service / compute engine / Centos 7.0;
Container : Docker / Docker-compose / Nginx
Dockerfile
FROM nginx
WORKDIR /usr/share/nginx/html
COPY ./client/dist ./
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker-compose
app:
build:
context: .
dockerfile: ./Dockerfile
environment:
- NODE_ENV=prod
- PORT=8081
volumes:
- /usr/share/nginx/html
ports:
- "8081:80"
Nginx
server {
listen 80;
server_name example.net;
root /usr/share/nginx/html;
index index.html;
charset utf-8;
# enable gzip
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
location ~* ^.+.(ico|gif|jpg|jpeg|png)$ {
expires 30d;
}
location ~* ^.+.(css|js|txt|xml|swf|wav)$ {
expires 24h;
}
location ~* ^.+.(html|htm)$ {
expires 1h;
}
location ~* ^.+.(eot|ttf|otf|woff|svg)$ {
expires max;
}
location / {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
try_files $uri /index.html;
}
}
Google Cloud Firewall
Google Cloud Firewall Port Image
I have a domain I have purchased (ex. example.net) and I have an VueJs app running on port 8081.
My application is working on example.net:8081... But I want it running only on example.net... But nothing...
Hope some will find where I am making a mistake...
Thank you for reading
PS : There is some people who will tell me this is probably a duplicate post but... 1. I do not find any good anwser to this, I would not ask for help I would find it. 2. Don't be mean please).
docker nginx dns docker-compose google-compute-engine
I am trying to link a domain I purchased to my Google Cloud service, using docker a Nginx but, I have try so many solution write on Stackoverflow... but all failed.
What did I miss... Do you have any idea ?
There is my files
Environnement
Domain : Google domain
Server : Google Cloud Service / compute engine / Centos 7.0;
Container : Docker / Docker-compose / Nginx
Dockerfile
FROM nginx
WORKDIR /usr/share/nginx/html
COPY ./client/dist ./
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker-compose
app:
build:
context: .
dockerfile: ./Dockerfile
environment:
- NODE_ENV=prod
- PORT=8081
volumes:
- /usr/share/nginx/html
ports:
- "8081:80"
Nginx
server {
listen 80;
server_name example.net;
root /usr/share/nginx/html;
index index.html;
charset utf-8;
# enable gzip
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
location ~* ^.+.(ico|gif|jpg|jpeg|png)$ {
expires 30d;
}
location ~* ^.+.(css|js|txt|xml|swf|wav)$ {
expires 24h;
}
location ~* ^.+.(html|htm)$ {
expires 1h;
}
location ~* ^.+.(eot|ttf|otf|woff|svg)$ {
expires max;
}
location / {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
try_files $uri /index.html;
}
}
Google Cloud Firewall
Google Cloud Firewall Port Image
I have a domain I have purchased (ex. example.net) and I have an VueJs app running on port 8081.
My application is working on example.net:8081... But I want it running only on example.net... But nothing...
Hope some will find where I am making a mistake...
Thank you for reading
PS : There is some people who will tell me this is probably a duplicate post but... 1. I do not find any good anwser to this, I would not ask for help I would find it. 2. Don't be mean please).
docker nginx dns docker-compose google-compute-engine
docker nginx dns docker-compose google-compute-engine
edited Dec 31 '18 at 8:57
Cœur
19.4k10116155
19.4k10116155
asked Nov 27 '18 at 2:05
Jérôme DupuisJérôme Dupuis
143
143
8081:80
you current bind container port 80 to 8081 on your server machine. But you want access to your domain without port, right ? So, bind 80 port inside container to80
port on serrver by change8081:80
to80:80
. And make sure theris nothing use 80 port on real serve machine by commandsudo lsof -i tcp:80
– Truong Dang
Nov 27 '18 at 5:58
Thanks you very much ! I will try this !!
– Jérôme Dupuis
Nov 27 '18 at 6:58
@TruongDang Problem solved ! Thanks a lot!
– Jérôme Dupuis
Nov 27 '18 at 7:07
So happy when i can help you ^^
– Truong Dang
Nov 27 '18 at 7:18
@Truong Dang Please post it as an answer for community visibility
– Digil
Nov 27 '18 at 21:00
|
show 2 more comments
8081:80
you current bind container port 80 to 8081 on your server machine. But you want access to your domain without port, right ? So, bind 80 port inside container to80
port on serrver by change8081:80
to80:80
. And make sure theris nothing use 80 port on real serve machine by commandsudo lsof -i tcp:80
– Truong Dang
Nov 27 '18 at 5:58
Thanks you very much ! I will try this !!
– Jérôme Dupuis
Nov 27 '18 at 6:58
@TruongDang Problem solved ! Thanks a lot!
– Jérôme Dupuis
Nov 27 '18 at 7:07
So happy when i can help you ^^
– Truong Dang
Nov 27 '18 at 7:18
@Truong Dang Please post it as an answer for community visibility
– Digil
Nov 27 '18 at 21:00
8081:80
you current bind container port 80 to 8081 on your server machine. But you want access to your domain without port, right ? So, bind 80 port inside container to 80
port on serrver by change8081:80
to 80:80
. And make sure theris nothing use 80 port on real serve machine by command sudo lsof -i tcp:80
– Truong Dang
Nov 27 '18 at 5:58
8081:80
you current bind container port 80 to 8081 on your server machine. But you want access to your domain without port, right ? So, bind 80 port inside container to 80
port on serrver by change8081:80
to 80:80
. And make sure theris nothing use 80 port on real serve machine by command sudo lsof -i tcp:80
– Truong Dang
Nov 27 '18 at 5:58
Thanks you very much ! I will try this !!
– Jérôme Dupuis
Nov 27 '18 at 6:58
Thanks you very much ! I will try this !!
– Jérôme Dupuis
Nov 27 '18 at 6:58
@TruongDang Problem solved ! Thanks a lot!
– Jérôme Dupuis
Nov 27 '18 at 7:07
@TruongDang Problem solved ! Thanks a lot!
– Jérôme Dupuis
Nov 27 '18 at 7:07
So happy when i can help you ^^
– Truong Dang
Nov 27 '18 at 7:18
So happy when i can help you ^^
– Truong Dang
Nov 27 '18 at 7:18
@Truong Dang Please post it as an answer for community visibility
– Digil
Nov 27 '18 at 21:00
@Truong Dang Please post it as an answer for community visibility
– Digil
Nov 27 '18 at 21:00
|
show 2 more comments
1 Answer
1
active
oldest
votes
8081:80
you current bind container port 80 to 8081
on your server machine. But you want access to your domain without port, right ? So, bind 80 port
inside container to 80 port
on serrver by change 8081:80
to 80:80
.
And make sure theris nothing use 80 port
on real serve machine by command:
sudo lsof -i tcp:80
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53491738%2flink-to-a-specific-domain-to-a-specific-port-nginx-docker-google-cloud-servi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
8081:80
you current bind container port 80 to 8081
on your server machine. But you want access to your domain without port, right ? So, bind 80 port
inside container to 80 port
on serrver by change 8081:80
to 80:80
.
And make sure theris nothing use 80 port
on real serve machine by command:
sudo lsof -i tcp:80
add a comment |
8081:80
you current bind container port 80 to 8081
on your server machine. But you want access to your domain without port, right ? So, bind 80 port
inside container to 80 port
on serrver by change 8081:80
to 80:80
.
And make sure theris nothing use 80 port
on real serve machine by command:
sudo lsof -i tcp:80
add a comment |
8081:80
you current bind container port 80 to 8081
on your server machine. But you want access to your domain without port, right ? So, bind 80 port
inside container to 80 port
on serrver by change 8081:80
to 80:80
.
And make sure theris nothing use 80 port
on real serve machine by command:
sudo lsof -i tcp:80
8081:80
you current bind container port 80 to 8081
on your server machine. But you want access to your domain without port, right ? So, bind 80 port
inside container to 80 port
on serrver by change 8081:80
to 80:80
.
And make sure theris nothing use 80 port
on real serve machine by command:
sudo lsof -i tcp:80
answered Nov 28 '18 at 0:45
Truong DangTruong Dang
687412
687412
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53491738%2flink-to-a-specific-domain-to-a-specific-port-nginx-docker-google-cloud-servi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
8081:80
you current bind container port 80 to 8081 on your server machine. But you want access to your domain without port, right ? So, bind 80 port inside container to80
port on serrver by change8081:80
to80:80
. And make sure theris nothing use 80 port on real serve machine by commandsudo lsof -i tcp:80
– Truong Dang
Nov 27 '18 at 5:58
Thanks you very much ! I will try this !!
– Jérôme Dupuis
Nov 27 '18 at 6:58
@TruongDang Problem solved ! Thanks a lot!
– Jérôme Dupuis
Nov 27 '18 at 7:07
So happy when i can help you ^^
– Truong Dang
Nov 27 '18 at 7:18
@Truong Dang Please post it as an answer for community visibility
– Digil
Nov 27 '18 at 21:00