What's the difference between starting nginx with command “nginx”, “service start nginx” and...
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have noticed that when ever I start nginx with ubuntu command "nginx" and I do systemctl status nginx. It shows that systemctl is disabled. More over if I first start nginx with command systemctl start nginx and i try to start nginx with command nginx, it check the availbility of the ports and then says nginx: [emerg] still could not bind(). So i thought there must be a differene and their purpose. When I strt nginx with command nginx the only way to stop nginx is by the means of force using killlall nginx or kill -9 (process id) or by clearing the port. So I am pretty sure there is some difference in them.
nginx nginx-location nginx-reverse-proxy
add a comment |
I have noticed that when ever I start nginx with ubuntu command "nginx" and I do systemctl status nginx. It shows that systemctl is disabled. More over if I first start nginx with command systemctl start nginx and i try to start nginx with command nginx, it check the availbility of the ports and then says nginx: [emerg] still could not bind(). So i thought there must be a differene and their purpose. When I strt nginx with command nginx the only way to stop nginx is by the means of force using killlall nginx or kill -9 (process id) or by clearing the port. So I am pretty sure there is some difference in them.
nginx nginx-location nginx-reverse-proxy
Not only got confused by nginx. I think you maybe confused by all processes that could be managed by systemctl and native command script. You should get some knowledge aboutsystemctl
, do not focus on nginx.
– Light.G
Jan 3 at 12:38
Thnks it helped me a lot but still its not clear why it is possible to start a process saperately with these two commands. That was the main reason I asked this question is the first place, nginx and systemctl start nginx if one is used and then it also tried to start the same demon with other command why? Thx for reply
– Mahad Ali
Jan 4 at 15:11
add a comment |
I have noticed that when ever I start nginx with ubuntu command "nginx" and I do systemctl status nginx. It shows that systemctl is disabled. More over if I first start nginx with command systemctl start nginx and i try to start nginx with command nginx, it check the availbility of the ports and then says nginx: [emerg] still could not bind(). So i thought there must be a differene and their purpose. When I strt nginx with command nginx the only way to stop nginx is by the means of force using killlall nginx or kill -9 (process id) or by clearing the port. So I am pretty sure there is some difference in them.
nginx nginx-location nginx-reverse-proxy
I have noticed that when ever I start nginx with ubuntu command "nginx" and I do systemctl status nginx. It shows that systemctl is disabled. More over if I first start nginx with command systemctl start nginx and i try to start nginx with command nginx, it check the availbility of the ports and then says nginx: [emerg] still could not bind(). So i thought there must be a differene and their purpose. When I strt nginx with command nginx the only way to stop nginx is by the means of force using killlall nginx or kill -9 (process id) or by clearing the port. So I am pretty sure there is some difference in them.
nginx nginx-location nginx-reverse-proxy
nginx nginx-location nginx-reverse-proxy
asked Jan 3 at 6:23
Mahad AliMahad Ali
1
1
Not only got confused by nginx. I think you maybe confused by all processes that could be managed by systemctl and native command script. You should get some knowledge aboutsystemctl
, do not focus on nginx.
– Light.G
Jan 3 at 12:38
Thnks it helped me a lot but still its not clear why it is possible to start a process saperately with these two commands. That was the main reason I asked this question is the first place, nginx and systemctl start nginx if one is used and then it also tried to start the same demon with other command why? Thx for reply
– Mahad Ali
Jan 4 at 15:11
add a comment |
Not only got confused by nginx. I think you maybe confused by all processes that could be managed by systemctl and native command script. You should get some knowledge aboutsystemctl
, do not focus on nginx.
– Light.G
Jan 3 at 12:38
Thnks it helped me a lot but still its not clear why it is possible to start a process saperately with these two commands. That was the main reason I asked this question is the first place, nginx and systemctl start nginx if one is used and then it also tried to start the same demon with other command why? Thx for reply
– Mahad Ali
Jan 4 at 15:11
Not only got confused by nginx. I think you maybe confused by all processes that could be managed by systemctl and native command script. You should get some knowledge about
systemctl
, do not focus on nginx.– Light.G
Jan 3 at 12:38
Not only got confused by nginx. I think you maybe confused by all processes that could be managed by systemctl and native command script. You should get some knowledge about
systemctl
, do not focus on nginx.– Light.G
Jan 3 at 12:38
Thnks it helped me a lot but still its not clear why it is possible to start a process saperately with these two commands. That was the main reason I asked this question is the first place, nginx and systemctl start nginx if one is used and then it also tried to start the same demon with other command why? Thx for reply
– Mahad Ali
Jan 4 at 15:11
Thnks it helped me a lot but still its not clear why it is possible to start a process saperately with these two commands. That was the main reason I asked this question is the first place, nginx and systemctl start nginx if one is used and then it also tried to start the same demon with other command why? Thx for reply
– Mahad Ali
Jan 4 at 15:11
add a comment |
2 Answers
2
active
oldest
votes
The difference between the examples you have provied is how the processes are being started.
Running the command nginx
will start the application and wait for your user action to stop it.
The systemctl
or service
commands are nearly the same thing and running service nginx start
or systemctl start nginx
will start a service in the background running the Nginx daemon.
You can also use this to do a service nginx restart
or systemctl restart nginx
to restart the service, or even a service nginx reload
/ systemctl reload nginx
to reload the configuration without completely stopping the Nginx server.
The reason why you can't do both nginx
and systemctl start nginx
is due to the nginx configuration already listening port 80, and you can't listen on the same port on a single IP address at the same time.
You can also force the nginx service to start on boot by running systemctl enable nginx
which will be why your systemctl status nginx
returns 'disabled'.
Hope this makes sense.
Yes it did helped a lot. Thnks can you also pls ans that why of nginx is already running with command nginx and why is that it is possible to start it with command systemctl start nginx? I mean if its already running why the system even attempts to start again?
– Mahad Ali
Jan 11 at 11:40
This is due to the fact that the computer will only perform the tasks it's told to do. So if you tell it to start nginx, it will start nginx for you and run into an error once it has failed to bind the ports.
– Steven T
Jan 12 at 12:16
Perhaps there is nothing to check as the command to execute the programs gets run , to check if the program can even run or not and hence it actually attempts to run the program. So now I am clear. Thnx
– Mahad Ali
Jan 15 at 20:39
add a comment |
service
command is just a simple script which basically abstract choosing the underlying init system (upstart, systemmd , /etc/init.d or systemctl).
since it being a very concise script, it only supports a very limited set of operations (start | stop | reload .. ).
However, if you actually want to perform the additional operation you need to make use of the actual init system in this case systemctl
An apt example would be starting the service on boot time using systemctl sudo systemctl enable the-name-of-service
which is not possible using service
Thnks but why is it possible to start the same demon with two commands? By that it means that when I try to start nginx with command nginx then it is also possible to initiate a pre running deamon with systemctl start nginx. Off course it doesn't work due to port being not free but still it makes me question. thnx for reply
– Mahad Ali
Jan 4 at 15:14
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%2f54017277%2fwhats-the-difference-between-starting-nginx-with-command-nginx-service-star%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The difference between the examples you have provied is how the processes are being started.
Running the command nginx
will start the application and wait for your user action to stop it.
The systemctl
or service
commands are nearly the same thing and running service nginx start
or systemctl start nginx
will start a service in the background running the Nginx daemon.
You can also use this to do a service nginx restart
or systemctl restart nginx
to restart the service, or even a service nginx reload
/ systemctl reload nginx
to reload the configuration without completely stopping the Nginx server.
The reason why you can't do both nginx
and systemctl start nginx
is due to the nginx configuration already listening port 80, and you can't listen on the same port on a single IP address at the same time.
You can also force the nginx service to start on boot by running systemctl enable nginx
which will be why your systemctl status nginx
returns 'disabled'.
Hope this makes sense.
Yes it did helped a lot. Thnks can you also pls ans that why of nginx is already running with command nginx and why is that it is possible to start it with command systemctl start nginx? I mean if its already running why the system even attempts to start again?
– Mahad Ali
Jan 11 at 11:40
This is due to the fact that the computer will only perform the tasks it's told to do. So if you tell it to start nginx, it will start nginx for you and run into an error once it has failed to bind the ports.
– Steven T
Jan 12 at 12:16
Perhaps there is nothing to check as the command to execute the programs gets run , to check if the program can even run or not and hence it actually attempts to run the program. So now I am clear. Thnx
– Mahad Ali
Jan 15 at 20:39
add a comment |
The difference between the examples you have provied is how the processes are being started.
Running the command nginx
will start the application and wait for your user action to stop it.
The systemctl
or service
commands are nearly the same thing and running service nginx start
or systemctl start nginx
will start a service in the background running the Nginx daemon.
You can also use this to do a service nginx restart
or systemctl restart nginx
to restart the service, or even a service nginx reload
/ systemctl reload nginx
to reload the configuration without completely stopping the Nginx server.
The reason why you can't do both nginx
and systemctl start nginx
is due to the nginx configuration already listening port 80, and you can't listen on the same port on a single IP address at the same time.
You can also force the nginx service to start on boot by running systemctl enable nginx
which will be why your systemctl status nginx
returns 'disabled'.
Hope this makes sense.
Yes it did helped a lot. Thnks can you also pls ans that why of nginx is already running with command nginx and why is that it is possible to start it with command systemctl start nginx? I mean if its already running why the system even attempts to start again?
– Mahad Ali
Jan 11 at 11:40
This is due to the fact that the computer will only perform the tasks it's told to do. So if you tell it to start nginx, it will start nginx for you and run into an error once it has failed to bind the ports.
– Steven T
Jan 12 at 12:16
Perhaps there is nothing to check as the command to execute the programs gets run , to check if the program can even run or not and hence it actually attempts to run the program. So now I am clear. Thnx
– Mahad Ali
Jan 15 at 20:39
add a comment |
The difference between the examples you have provied is how the processes are being started.
Running the command nginx
will start the application and wait for your user action to stop it.
The systemctl
or service
commands are nearly the same thing and running service nginx start
or systemctl start nginx
will start a service in the background running the Nginx daemon.
You can also use this to do a service nginx restart
or systemctl restart nginx
to restart the service, or even a service nginx reload
/ systemctl reload nginx
to reload the configuration without completely stopping the Nginx server.
The reason why you can't do both nginx
and systemctl start nginx
is due to the nginx configuration already listening port 80, and you can't listen on the same port on a single IP address at the same time.
You can also force the nginx service to start on boot by running systemctl enable nginx
which will be why your systemctl status nginx
returns 'disabled'.
Hope this makes sense.
The difference between the examples you have provied is how the processes are being started.
Running the command nginx
will start the application and wait for your user action to stop it.
The systemctl
or service
commands are nearly the same thing and running service nginx start
or systemctl start nginx
will start a service in the background running the Nginx daemon.
You can also use this to do a service nginx restart
or systemctl restart nginx
to restart the service, or even a service nginx reload
/ systemctl reload nginx
to reload the configuration without completely stopping the Nginx server.
The reason why you can't do both nginx
and systemctl start nginx
is due to the nginx configuration already listening port 80, and you can't listen on the same port on a single IP address at the same time.
You can also force the nginx service to start on boot by running systemctl enable nginx
which will be why your systemctl status nginx
returns 'disabled'.
Hope this makes sense.
answered Jan 3 at 6:35
Steven TSteven T
1544
1544
Yes it did helped a lot. Thnks can you also pls ans that why of nginx is already running with command nginx and why is that it is possible to start it with command systemctl start nginx? I mean if its already running why the system even attempts to start again?
– Mahad Ali
Jan 11 at 11:40
This is due to the fact that the computer will only perform the tasks it's told to do. So if you tell it to start nginx, it will start nginx for you and run into an error once it has failed to bind the ports.
– Steven T
Jan 12 at 12:16
Perhaps there is nothing to check as the command to execute the programs gets run , to check if the program can even run or not and hence it actually attempts to run the program. So now I am clear. Thnx
– Mahad Ali
Jan 15 at 20:39
add a comment |
Yes it did helped a lot. Thnks can you also pls ans that why of nginx is already running with command nginx and why is that it is possible to start it with command systemctl start nginx? I mean if its already running why the system even attempts to start again?
– Mahad Ali
Jan 11 at 11:40
This is due to the fact that the computer will only perform the tasks it's told to do. So if you tell it to start nginx, it will start nginx for you and run into an error once it has failed to bind the ports.
– Steven T
Jan 12 at 12:16
Perhaps there is nothing to check as the command to execute the programs gets run , to check if the program can even run or not and hence it actually attempts to run the program. So now I am clear. Thnx
– Mahad Ali
Jan 15 at 20:39
Yes it did helped a lot. Thnks can you also pls ans that why of nginx is already running with command nginx and why is that it is possible to start it with command systemctl start nginx? I mean if its already running why the system even attempts to start again?
– Mahad Ali
Jan 11 at 11:40
Yes it did helped a lot. Thnks can you also pls ans that why of nginx is already running with command nginx and why is that it is possible to start it with command systemctl start nginx? I mean if its already running why the system even attempts to start again?
– Mahad Ali
Jan 11 at 11:40
This is due to the fact that the computer will only perform the tasks it's told to do. So if you tell it to start nginx, it will start nginx for you and run into an error once it has failed to bind the ports.
– Steven T
Jan 12 at 12:16
This is due to the fact that the computer will only perform the tasks it's told to do. So if you tell it to start nginx, it will start nginx for you and run into an error once it has failed to bind the ports.
– Steven T
Jan 12 at 12:16
Perhaps there is nothing to check as the command to execute the programs gets run , to check if the program can even run or not and hence it actually attempts to run the program. So now I am clear. Thnx
– Mahad Ali
Jan 15 at 20:39
Perhaps there is nothing to check as the command to execute the programs gets run , to check if the program can even run or not and hence it actually attempts to run the program. So now I am clear. Thnx
– Mahad Ali
Jan 15 at 20:39
add a comment |
service
command is just a simple script which basically abstract choosing the underlying init system (upstart, systemmd , /etc/init.d or systemctl).
since it being a very concise script, it only supports a very limited set of operations (start | stop | reload .. ).
However, if you actually want to perform the additional operation you need to make use of the actual init system in this case systemctl
An apt example would be starting the service on boot time using systemctl sudo systemctl enable the-name-of-service
which is not possible using service
Thnks but why is it possible to start the same demon with two commands? By that it means that when I try to start nginx with command nginx then it is also possible to initiate a pre running deamon with systemctl start nginx. Off course it doesn't work due to port being not free but still it makes me question. thnx for reply
– Mahad Ali
Jan 4 at 15:14
add a comment |
service
command is just a simple script which basically abstract choosing the underlying init system (upstart, systemmd , /etc/init.d or systemctl).
since it being a very concise script, it only supports a very limited set of operations (start | stop | reload .. ).
However, if you actually want to perform the additional operation you need to make use of the actual init system in this case systemctl
An apt example would be starting the service on boot time using systemctl sudo systemctl enable the-name-of-service
which is not possible using service
Thnks but why is it possible to start the same demon with two commands? By that it means that when I try to start nginx with command nginx then it is also possible to initiate a pre running deamon with systemctl start nginx. Off course it doesn't work due to port being not free but still it makes me question. thnx for reply
– Mahad Ali
Jan 4 at 15:14
add a comment |
service
command is just a simple script which basically abstract choosing the underlying init system (upstart, systemmd , /etc/init.d or systemctl).
since it being a very concise script, it only supports a very limited set of operations (start | stop | reload .. ).
However, if you actually want to perform the additional operation you need to make use of the actual init system in this case systemctl
An apt example would be starting the service on boot time using systemctl sudo systemctl enable the-name-of-service
which is not possible using service
service
command is just a simple script which basically abstract choosing the underlying init system (upstart, systemmd , /etc/init.d or systemctl).
since it being a very concise script, it only supports a very limited set of operations (start | stop | reload .. ).
However, if you actually want to perform the additional operation you need to make use of the actual init system in this case systemctl
An apt example would be starting the service on boot time using systemctl sudo systemctl enable the-name-of-service
which is not possible using service
answered Jan 3 at 6:40
ahhmarrahhmarr
95611524
95611524
Thnks but why is it possible to start the same demon with two commands? By that it means that when I try to start nginx with command nginx then it is also possible to initiate a pre running deamon with systemctl start nginx. Off course it doesn't work due to port being not free but still it makes me question. thnx for reply
– Mahad Ali
Jan 4 at 15:14
add a comment |
Thnks but why is it possible to start the same demon with two commands? By that it means that when I try to start nginx with command nginx then it is also possible to initiate a pre running deamon with systemctl start nginx. Off course it doesn't work due to port being not free but still it makes me question. thnx for reply
– Mahad Ali
Jan 4 at 15:14
Thnks but why is it possible to start the same demon with two commands? By that it means that when I try to start nginx with command nginx then it is also possible to initiate a pre running deamon with systemctl start nginx. Off course it doesn't work due to port being not free but still it makes me question. thnx for reply
– Mahad Ali
Jan 4 at 15:14
Thnks but why is it possible to start the same demon with two commands? By that it means that when I try to start nginx with command nginx then it is also possible to initiate a pre running deamon with systemctl start nginx. Off course it doesn't work due to port being not free but still it makes me question. thnx for reply
– Mahad Ali
Jan 4 at 15:14
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%2f54017277%2fwhats-the-difference-between-starting-nginx-with-command-nginx-service-star%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
Not only got confused by nginx. I think you maybe confused by all processes that could be managed by systemctl and native command script. You should get some knowledge about
systemctl
, do not focus on nginx.– Light.G
Jan 3 at 12:38
Thnks it helped me a lot but still its not clear why it is possible to start a process saperately with these two commands. That was the main reason I asked this question is the first place, nginx and systemctl start nginx if one is used and then it also tried to start the same demon with other command why? Thx for reply
– Mahad Ali
Jan 4 at 15:11