Reputation: 107
I am a complete beginner to nginx. I am using Ubuntu 16.04. I followed the steps,
sudo vi /etc/nginx/sites-available/default(here i found a file with default configuration as below)
server {
listen 8080 default_server;
listen[::]: 8080 default_server;
root /var/www/html;
index index.html index.htm index.nginx - debian.html;
server_name _;
location / {
try_files $uri $uri / = 404;
}
}
then i started the nginx, using
sudo service nginx start
It shows the welcome page of nginx. Now i changed the root, like,
server {
listen 8080 default_server;
listen[::]: 8080 default_server;
root /home/user1/folder1/dist; //this is the path i want to insert in nginx
index index.html;
server_name _;
location / {
try_files $uri $uri / = 404;
}
}
now when i resart the ngnix, i had a problem that,
user1@admin-xxx:/etc/nginx/sites-available$ sudo service nginx restart stop: Unknown instance: nginx stop/pre-start,process 4726
why here i am getting this pre-start, how to prevent this?, what does this mean?, and i want to restart the nginx. Can anyone please tell me how to force stop the nginx and to restart it? As a beginner i could not figure it out,. please help me out..
Upvotes: 0
Views: 1294
Reputation: 119
usually use sudo nginx -s reload. Before restart, use sudo nginx -t to make sure the configuration is correct.
Upvotes: 2