nginx not restartingCan't pass PCI scans for vulnerability compliance SSL_OP_DONT_INSERT_EMPTY_FRAGMENTSnginx.conf not properly restartingApache2 error no listening sockets avaliableNginx installation error in Ubuntu 16.04Restarting nginx in a Docker containerNginx failed question programs not downloadingGet Apache2 running with nginx as reverse proxy

Why there isn't public transport on Christmas Day in the UK

Finishing pre-cooked prime rib, day-of?

Toxic culture - I'm putting in more resources to help the project move faster, but people are slowing down

How can I ensure consistency in web design?

As of 2019, why do mountaineering courses still teach how to use a paper map?

The default C drive is too small. How to make Windows boot from D drive

Are the stars distributed in uniform distribution, on the celestial dome, with respect to brightness?

"Government transplant" been tried? At what scale, and what were the results?

Upgrade new bike to 11 speed or downgrade trainers wheel to 8 speed

IndexField attribute not working after upgrade to 9.2 on Solr

What is separation between policy and mechanism?

What does a reduction gearbox do in a turbofan engine?

Tactical illusion combat countermeasures (password system)

What did Harry mean when he said "Well, I take it you're not sorry?" to Griphook?

Finding longest overlapping ranges

Equivalent circuit of a non-ideal resistor

How to keep track of what has been done to a TeX file?

Modeling in pure math

What is the moral difference between abortion and infanticide?

Do not combine certain elements in Split or SplitBy

Case-insensitive collation still comparing case-sensitive

Should we stop differentiating between ln and log?

Using only one terminal, can I interrupt a process that's hung on very early Unix versions?

What can Scotland legally do to get independence?



nginx not restarting


Can't pass PCI scans for vulnerability compliance SSL_OP_DONT_INSERT_EMPTY_FRAGMENTSnginx.conf not properly restartingApache2 error no listening sockets avaliableNginx installation error in Ubuntu 16.04Restarting nginx in a Docker containerNginx failed question programs not downloadingGet Apache2 running with nginx as reverse proxy






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









0


















I installed nginx on my Ubuntu 18.04. After that I made some changes in the default file. Now I am trying to start it but I am getting following error:



$ sudo service nginx restart

Job for nginx.service failed because the control process exited with
error code. See "systemctl status nginx.service" and "journalctl -xe"
for details.


$ systemctl status nginx.service
nginx.service - A high performance web server and a reverse proxy
server Loaded: loaded (/lib/systemd/system/nginx.service; enabled;
vendor preset: en Active: failed (Result: exit-code) since Sat
2019-05-25 13:35:03 CDT; 19min a
Docs: man:nginx(8) Process: 3220 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code Process: 3219
ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process

May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to
0.0.0.0:80 failed May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25 13:35:02 lc2530hz nginx[3220]:
nginx: [emerg] bind() to 0.0.0.0:80 failed May 25 13:35:02 lc2530hz
nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25
13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to 0.0.0.0:80
failed May 25 13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to
[::]:80 failed (9 May 25 13:35:03 lc2530hz nginx[3220]: nginx: [emerg]
still could not bind() May 25 13:35:03 lc2530hz systemd[1]:
nginx.service: Control process exited, code May 25 13:35:03 lc2530hz
systemd[1]: nginx.service: Failed with result 'exit-cod May 25
13:35:03 lc2530hz systemd[1]: Failed to start A high performance web
serv lines 1-17/17 (END)


$ journalctl -xe
Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit phpsessionclean.service has finished starting up.
--
-- The start-up result is RESULT.
May 25 13:42:32 lc2530hz systemd[1]: Starting Message of the Day...
-- Subject: Unit motd-news.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit motd-news.service has begun starting up.
May 25 13:42:32 lc2530hz systemd[1]: Started Message of the Day.
-- Subject: Unit motd-news.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit motd-news.service has finished starting up.
--
-- The start-up result is RESULT.
May 25 13:42:53 lc2530hz org.gnome.Shell.desktop[1989]: (/usr/lib/firefox/firefo
May 25 13:42:58 lc2530hz systemd-resolved[782]: Server returned error NXDOMAIN,
May 25 13:47:19 lc2530hz /usr/lib/gdm3/gdm-x-session[1855]: (II) event5 - PixAr
lines 1576-1598/1598 (END)


$ nginx -t
nginx: [alert] could not open error log file: open()
"/var/log/nginx/error.log" failed (13: Permission denied) 2019/05/25
14:01:03 [warn] 3564#3564: the "user" directive makes sense only if
the master process runs with super-user privileges, ignored in
/etc/nginx/nginx.conf:1 nginx: the configuration file
/etc/nginx/nginx.conf syntax is ok 2019/05/25 14:01:03 [emerg]
3564#3564: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed
zulfi@lc2530hz:/etc/nginx/sites-enabled$


/etc/nginx/sites-enabled$ cat default
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

Default server configuration
server
listen 80 default_server;
listen [::]:80 default_server;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
#
include snippets/snakeoil.conf;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;

#server_name_;

location /
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/=404;


# pass PHP scripts to FastCGI server
# location ~ .php$
# include snippets/fastcgi-php.conf;
#
# With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
#

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one #
#location ~ /.ht
# deny all;
#



# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location /
# try_files $uri $uri/ =404;
#
# user@lc2530hz:/etc/nginx/sites-enabled$


Somebody please guide me how to restart the nginx.










share|improve this question

































    0


















    I installed nginx on my Ubuntu 18.04. After that I made some changes in the default file. Now I am trying to start it but I am getting following error:



    $ sudo service nginx restart

    Job for nginx.service failed because the control process exited with
    error code. See "systemctl status nginx.service" and "journalctl -xe"
    for details.


    $ systemctl status nginx.service
    nginx.service - A high performance web server and a reverse proxy
    server Loaded: loaded (/lib/systemd/system/nginx.service; enabled;
    vendor preset: en Active: failed (Result: exit-code) since Sat
    2019-05-25 13:35:03 CDT; 19min a
    Docs: man:nginx(8) Process: 3220 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code Process: 3219
    ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process

    May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to
    0.0.0.0:80 failed May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25 13:35:02 lc2530hz nginx[3220]:
    nginx: [emerg] bind() to 0.0.0.0:80 failed May 25 13:35:02 lc2530hz
    nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25
    13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to 0.0.0.0:80
    failed May 25 13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to
    [::]:80 failed (9 May 25 13:35:03 lc2530hz nginx[3220]: nginx: [emerg]
    still could not bind() May 25 13:35:03 lc2530hz systemd[1]:
    nginx.service: Control process exited, code May 25 13:35:03 lc2530hz
    systemd[1]: nginx.service: Failed with result 'exit-cod May 25
    13:35:03 lc2530hz systemd[1]: Failed to start A high performance web
    serv lines 1-17/17 (END)


    $ journalctl -xe
    Defined-By: systemd
    -- Support: http://www.ubuntu.com/support
    --
    -- Unit phpsessionclean.service has finished starting up.
    --
    -- The start-up result is RESULT.
    May 25 13:42:32 lc2530hz systemd[1]: Starting Message of the Day...
    -- Subject: Unit motd-news.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://www.ubuntu.com/support
    --
    -- Unit motd-news.service has begun starting up.
    May 25 13:42:32 lc2530hz systemd[1]: Started Message of the Day.
    -- Subject: Unit motd-news.service has finished start-up
    -- Defined-By: systemd
    -- Support: http://www.ubuntu.com/support
    --
    -- Unit motd-news.service has finished starting up.
    --
    -- The start-up result is RESULT.
    May 25 13:42:53 lc2530hz org.gnome.Shell.desktop[1989]: (/usr/lib/firefox/firefo
    May 25 13:42:58 lc2530hz systemd-resolved[782]: Server returned error NXDOMAIN,
    May 25 13:47:19 lc2530hz /usr/lib/gdm3/gdm-x-session[1855]: (II) event5 - PixAr
    lines 1576-1598/1598 (END)


    $ nginx -t
    nginx: [alert] could not open error log file: open()
    "/var/log/nginx/error.log" failed (13: Permission denied) 2019/05/25
    14:01:03 [warn] 3564#3564: the "user" directive makes sense only if
    the master process runs with super-user privileges, ignored in
    /etc/nginx/nginx.conf:1 nginx: the configuration file
    /etc/nginx/nginx.conf syntax is ok 2019/05/25 14:01:03 [emerg]
    3564#3564: open() "/run/nginx.pid" failed (13: Permission denied)
    nginx: configuration file /etc/nginx/nginx.conf test failed
    zulfi@lc2530hz:/etc/nginx/sites-enabled$


    /etc/nginx/sites-enabled$ cat default
    ##
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # https://www.nginx.com/resources/wiki/start/
    # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
    # https://wiki.debian.org/Nginx/DirectoryStructure
    #
    # In most cases, administrators will remove this file from sites-enabled/ and
    # leave it as reference inside of sites-available where it will continue to be
    # updated by the nginx packaging team.
    #
    # This file will automatically load configuration files provided by other
    # applications, such as Drupal or Wordpress. These applications will be made
    # available underneath a path with that package name, such as /drupal8.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##

    Default server configuration
    server
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    #
    include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    #server_name_;

    location /
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/=404;


    # pass PHP scripts to FastCGI server
    # location ~ .php$
    # include snippets/fastcgi-php.conf;
    #
    # With php-fpm (or other unix sockets):
    # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    # With php-cgi (or other tcp sockets):
    # fastcgi_pass 127.0.0.1:9000;
    # fastcgi_index index.php;
    # include fastcgi_params;
    #

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one #
    #location ~ /.ht
    # deny all;
    #



    # Virtual Host configuration for example.com
    #
    # You can move that to a different file under sites-available/ and symlink that
    # to sites-enabled/ to enable it.
    #
    #server
    # listen 80;
    # listen [::]:80;
    #
    # server_name example.com;
    #
    # root /var/www/example.com;
    # index index.html;
    #
    # location /
    # try_files $uri $uri/ =404;
    #
    # user@lc2530hz:/etc/nginx/sites-enabled$


    Somebody please guide me how to restart the nginx.










    share|improve this question





























      0













      0









      0








      I installed nginx on my Ubuntu 18.04. After that I made some changes in the default file. Now I am trying to start it but I am getting following error:



      $ sudo service nginx restart

      Job for nginx.service failed because the control process exited with
      error code. See "systemctl status nginx.service" and "journalctl -xe"
      for details.


      $ systemctl status nginx.service
      nginx.service - A high performance web server and a reverse proxy
      server Loaded: loaded (/lib/systemd/system/nginx.service; enabled;
      vendor preset: en Active: failed (Result: exit-code) since Sat
      2019-05-25 13:35:03 CDT; 19min a
      Docs: man:nginx(8) Process: 3220 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code Process: 3219
      ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process

      May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to
      0.0.0.0:80 failed May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25 13:35:02 lc2530hz nginx[3220]:
      nginx: [emerg] bind() to 0.0.0.0:80 failed May 25 13:35:02 lc2530hz
      nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25
      13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to 0.0.0.0:80
      failed May 25 13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to
      [::]:80 failed (9 May 25 13:35:03 lc2530hz nginx[3220]: nginx: [emerg]
      still could not bind() May 25 13:35:03 lc2530hz systemd[1]:
      nginx.service: Control process exited, code May 25 13:35:03 lc2530hz
      systemd[1]: nginx.service: Failed with result 'exit-cod May 25
      13:35:03 lc2530hz systemd[1]: Failed to start A high performance web
      serv lines 1-17/17 (END)


      $ journalctl -xe
      Defined-By: systemd
      -- Support: http://www.ubuntu.com/support
      --
      -- Unit phpsessionclean.service has finished starting up.
      --
      -- The start-up result is RESULT.
      May 25 13:42:32 lc2530hz systemd[1]: Starting Message of the Day...
      -- Subject: Unit motd-news.service has begun start-up
      -- Defined-By: systemd
      -- Support: http://www.ubuntu.com/support
      --
      -- Unit motd-news.service has begun starting up.
      May 25 13:42:32 lc2530hz systemd[1]: Started Message of the Day.
      -- Subject: Unit motd-news.service has finished start-up
      -- Defined-By: systemd
      -- Support: http://www.ubuntu.com/support
      --
      -- Unit motd-news.service has finished starting up.
      --
      -- The start-up result is RESULT.
      May 25 13:42:53 lc2530hz org.gnome.Shell.desktop[1989]: (/usr/lib/firefox/firefo
      May 25 13:42:58 lc2530hz systemd-resolved[782]: Server returned error NXDOMAIN,
      May 25 13:47:19 lc2530hz /usr/lib/gdm3/gdm-x-session[1855]: (II) event5 - PixAr
      lines 1576-1598/1598 (END)


      $ nginx -t
      nginx: [alert] could not open error log file: open()
      "/var/log/nginx/error.log" failed (13: Permission denied) 2019/05/25
      14:01:03 [warn] 3564#3564: the "user" directive makes sense only if
      the master process runs with super-user privileges, ignored in
      /etc/nginx/nginx.conf:1 nginx: the configuration file
      /etc/nginx/nginx.conf syntax is ok 2019/05/25 14:01:03 [emerg]
      3564#3564: open() "/run/nginx.pid" failed (13: Permission denied)
      nginx: configuration file /etc/nginx/nginx.conf test failed
      zulfi@lc2530hz:/etc/nginx/sites-enabled$


      /etc/nginx/sites-enabled$ cat default
      ##
      # You should look at the following URL's in order to grasp a solid understanding
      # of Nginx configuration files in order to fully unleash the power of Nginx.
      # https://www.nginx.com/resources/wiki/start/
      # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
      # https://wiki.debian.org/Nginx/DirectoryStructure
      #
      # In most cases, administrators will remove this file from sites-enabled/ and
      # leave it as reference inside of sites-available where it will continue to be
      # updated by the nginx packaging team.
      #
      # This file will automatically load configuration files provided by other
      # applications, such as Drupal or Wordpress. These applications will be made
      # available underneath a path with that package name, such as /drupal8.
      #
      # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
      ##

      Default server configuration
      server
      listen 80 default_server;
      listen [::]:80 default_server;

      # SSL configuration
      #
      # listen 443 ssl default_server;
      # listen [::]:443 ssl default_server;
      #
      # Note: You should disable gzip for SSL traffic.
      # See: https://bugs.debian.org/773332
      #
      # Read up on ssl_ciphers to ensure a secure configuration.
      # See: https://bugs.debian.org/765782
      #
      # Self signed certs generated by the ssl-cert package
      # Don't use them in a production server!
      #
      #
      include snippets/snakeoil.conf;

      root /var/www/html;

      # Add index.php to the list if you are using PHP
      index index.php index.html index.htm index.nginx-debian.html;

      #server_name_;

      location /
      # First attempt to serve request as file, then
      # as directory, then fall back to displaying a 404.
      try_files $uri $uri/=404;


      # pass PHP scripts to FastCGI server
      # location ~ .php$
      # include snippets/fastcgi-php.conf;
      #
      # With php-fpm (or other unix sockets):
      # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
      # With php-cgi (or other tcp sockets):
      # fastcgi_pass 127.0.0.1:9000;
      # fastcgi_index index.php;
      # include fastcgi_params;
      #

      # deny access to .htaccess files, if Apache's document root
      # concurs with nginx's one #
      #location ~ /.ht
      # deny all;
      #



      # Virtual Host configuration for example.com
      #
      # You can move that to a different file under sites-available/ and symlink that
      # to sites-enabled/ to enable it.
      #
      #server
      # listen 80;
      # listen [::]:80;
      #
      # server_name example.com;
      #
      # root /var/www/example.com;
      # index index.html;
      #
      # location /
      # try_files $uri $uri/ =404;
      #
      # user@lc2530hz:/etc/nginx/sites-enabled$


      Somebody please guide me how to restart the nginx.










      share|improve this question
















      I installed nginx on my Ubuntu 18.04. After that I made some changes in the default file. Now I am trying to start it but I am getting following error:



      $ sudo service nginx restart

      Job for nginx.service failed because the control process exited with
      error code. See "systemctl status nginx.service" and "journalctl -xe"
      for details.


      $ systemctl status nginx.service
      nginx.service - A high performance web server and a reverse proxy
      server Loaded: loaded (/lib/systemd/system/nginx.service; enabled;
      vendor preset: en Active: failed (Result: exit-code) since Sat
      2019-05-25 13:35:03 CDT; 19min a
      Docs: man:nginx(8) Process: 3220 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code Process: 3219
      ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process

      May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to
      0.0.0.0:80 failed May 25 13:35:01 lc2530hz nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25 13:35:02 lc2530hz nginx[3220]:
      nginx: [emerg] bind() to 0.0.0.0:80 failed May 25 13:35:02 lc2530hz
      nginx[3220]: nginx: [emerg] bind() to [::]:80 failed (9 May 25
      13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to 0.0.0.0:80
      failed May 25 13:35:02 lc2530hz nginx[3220]: nginx: [emerg] bind() to
      [::]:80 failed (9 May 25 13:35:03 lc2530hz nginx[3220]: nginx: [emerg]
      still could not bind() May 25 13:35:03 lc2530hz systemd[1]:
      nginx.service: Control process exited, code May 25 13:35:03 lc2530hz
      systemd[1]: nginx.service: Failed with result 'exit-cod May 25
      13:35:03 lc2530hz systemd[1]: Failed to start A high performance web
      serv lines 1-17/17 (END)


      $ journalctl -xe
      Defined-By: systemd
      -- Support: http://www.ubuntu.com/support
      --
      -- Unit phpsessionclean.service has finished starting up.
      --
      -- The start-up result is RESULT.
      May 25 13:42:32 lc2530hz systemd[1]: Starting Message of the Day...
      -- Subject: Unit motd-news.service has begun start-up
      -- Defined-By: systemd
      -- Support: http://www.ubuntu.com/support
      --
      -- Unit motd-news.service has begun starting up.
      May 25 13:42:32 lc2530hz systemd[1]: Started Message of the Day.
      -- Subject: Unit motd-news.service has finished start-up
      -- Defined-By: systemd
      -- Support: http://www.ubuntu.com/support
      --
      -- Unit motd-news.service has finished starting up.
      --
      -- The start-up result is RESULT.
      May 25 13:42:53 lc2530hz org.gnome.Shell.desktop[1989]: (/usr/lib/firefox/firefo
      May 25 13:42:58 lc2530hz systemd-resolved[782]: Server returned error NXDOMAIN,
      May 25 13:47:19 lc2530hz /usr/lib/gdm3/gdm-x-session[1855]: (II) event5 - PixAr
      lines 1576-1598/1598 (END)


      $ nginx -t
      nginx: [alert] could not open error log file: open()
      "/var/log/nginx/error.log" failed (13: Permission denied) 2019/05/25
      14:01:03 [warn] 3564#3564: the "user" directive makes sense only if
      the master process runs with super-user privileges, ignored in
      /etc/nginx/nginx.conf:1 nginx: the configuration file
      /etc/nginx/nginx.conf syntax is ok 2019/05/25 14:01:03 [emerg]
      3564#3564: open() "/run/nginx.pid" failed (13: Permission denied)
      nginx: configuration file /etc/nginx/nginx.conf test failed
      zulfi@lc2530hz:/etc/nginx/sites-enabled$


      /etc/nginx/sites-enabled$ cat default
      ##
      # You should look at the following URL's in order to grasp a solid understanding
      # of Nginx configuration files in order to fully unleash the power of Nginx.
      # https://www.nginx.com/resources/wiki/start/
      # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
      # https://wiki.debian.org/Nginx/DirectoryStructure
      #
      # In most cases, administrators will remove this file from sites-enabled/ and
      # leave it as reference inside of sites-available where it will continue to be
      # updated by the nginx packaging team.
      #
      # This file will automatically load configuration files provided by other
      # applications, such as Drupal or Wordpress. These applications will be made
      # available underneath a path with that package name, such as /drupal8.
      #
      # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
      ##

      Default server configuration
      server
      listen 80 default_server;
      listen [::]:80 default_server;

      # SSL configuration
      #
      # listen 443 ssl default_server;
      # listen [::]:443 ssl default_server;
      #
      # Note: You should disable gzip for SSL traffic.
      # See: https://bugs.debian.org/773332
      #
      # Read up on ssl_ciphers to ensure a secure configuration.
      # See: https://bugs.debian.org/765782
      #
      # Self signed certs generated by the ssl-cert package
      # Don't use them in a production server!
      #
      #
      include snippets/snakeoil.conf;

      root /var/www/html;

      # Add index.php to the list if you are using PHP
      index index.php index.html index.htm index.nginx-debian.html;

      #server_name_;

      location /
      # First attempt to serve request as file, then
      # as directory, then fall back to displaying a 404.
      try_files $uri $uri/=404;


      # pass PHP scripts to FastCGI server
      # location ~ .php$
      # include snippets/fastcgi-php.conf;
      #
      # With php-fpm (or other unix sockets):
      # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
      # With php-cgi (or other tcp sockets):
      # fastcgi_pass 127.0.0.1:9000;
      # fastcgi_index index.php;
      # include fastcgi_params;
      #

      # deny access to .htaccess files, if Apache's document root
      # concurs with nginx's one #
      #location ~ /.ht
      # deny all;
      #



      # Virtual Host configuration for example.com
      #
      # You can move that to a different file under sites-available/ and symlink that
      # to sites-enabled/ to enable it.
      #
      #server
      # listen 80;
      # listen [::]:80;
      #
      # server_name example.com;
      #
      # root /var/www/example.com;
      # index index.html;
      #
      # location /
      # try_files $uri $uri/ =404;
      #
      # user@lc2530hz:/etc/nginx/sites-enabled$


      Somebody please guide me how to restart the nginx.







      nginx






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 2 at 12:07









      Melebius

      8,0916 gold badges30 silver badges57 bronze badges




      8,0916 gold badges30 silver badges57 bronze badges










      asked May 26 at 5:16









      user2994783user2994783

      1237 bronze badges




      1237 bronze badges























          3 Answers
          3






          active

          oldest

          votes


















          0



















          It seems as if your Port 80 is blocked. (nginx: [emerg] bind() to 0.0.0.0:80 failed)
          Try:



          sudo netstat -lntp | grep ":80"


          to find out which process is blocking the port, kill the programm/service and restart nginx.



          I'd also advice you to run nginx -t as the user nginx is running as, so the



          nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed


          gives you a clear indication on wether there actually is a problem writing the logfile. Running this as your standard user may lead to incorrect results if you don't have the same access rights as for example the http user.






          share|improve this answer
































            0



















            First validate that the configuration files are valid:



            sudo nginx -t


            Apply the changes without restarting the Nginx service:



            sudo nginx -s reload


            If the changes are not applied immediately, restart the service with the following command (unlike the command used in the previous step, it will abruptly close all web client connections):



            sudo systemctl restart nginx


            In the extreme case, you can kill the process and start it again with:



            sudo pkill -9 nginx && sudo systemctl start nginx


            In some cases Nginx may fail to restart because some child processes or another process (Apache or httpd) are using port 80 or 443. In these cases I recommend stopping Nginx (sudo systemctl stop nginx) and validate if any process continues to listen in the port 80:



            sudo netstat -ant | grep ": 80"


            You can see more details with:



            sudo lsof -i -P -n | grep ": 80"


            To see the running processes more easily you can use htop.



            When nobody is using the TCP/80 port, you can start Nginx again:



            sudo systemctl start nginx





            share|improve this answer


































              0



















              try this, it's for as root user check the service, disable, enable again and start.



              sudo -i
              systemctl check nginx
              systemctl disable nginx
              systemctl enable nginx
              systemctl start nginx





              share|improve this answer


























                Your Answer








                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "89"
                ;
                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/4.0/"u003ecc by-sa 4.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
                );



                );














                draft saved

                draft discarded
















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1146244%2fnginx-not-restarting%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown


























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                0



















                It seems as if your Port 80 is blocked. (nginx: [emerg] bind() to 0.0.0.0:80 failed)
                Try:



                sudo netstat -lntp | grep ":80"


                to find out which process is blocking the port, kill the programm/service and restart nginx.



                I'd also advice you to run nginx -t as the user nginx is running as, so the



                nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed


                gives you a clear indication on wether there actually is a problem writing the logfile. Running this as your standard user may lead to incorrect results if you don't have the same access rights as for example the http user.






                share|improve this answer





























                  0



















                  It seems as if your Port 80 is blocked. (nginx: [emerg] bind() to 0.0.0.0:80 failed)
                  Try:



                  sudo netstat -lntp | grep ":80"


                  to find out which process is blocking the port, kill the programm/service and restart nginx.



                  I'd also advice you to run nginx -t as the user nginx is running as, so the



                  nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed


                  gives you a clear indication on wether there actually is a problem writing the logfile. Running this as your standard user may lead to incorrect results if you don't have the same access rights as for example the http user.






                  share|improve this answer



























                    0















                    0











                    0









                    It seems as if your Port 80 is blocked. (nginx: [emerg] bind() to 0.0.0.0:80 failed)
                    Try:



                    sudo netstat -lntp | grep ":80"


                    to find out which process is blocking the port, kill the programm/service and restart nginx.



                    I'd also advice you to run nginx -t as the user nginx is running as, so the



                    nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed


                    gives you a clear indication on wether there actually is a problem writing the logfile. Running this as your standard user may lead to incorrect results if you don't have the same access rights as for example the http user.






                    share|improve this answer














                    It seems as if your Port 80 is blocked. (nginx: [emerg] bind() to 0.0.0.0:80 failed)
                    Try:



                    sudo netstat -lntp | grep ":80"


                    to find out which process is blocking the port, kill the programm/service and restart nginx.



                    I'd also advice you to run nginx -t as the user nginx is running as, so the



                    nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed


                    gives you a clear indication on wether there actually is a problem writing the logfile. Running this as your standard user may lead to incorrect results if you don't have the same access rights as for example the http user.







                    share|improve this answer













                    share|improve this answer




                    share|improve this answer










                    answered Oct 2 at 9:14









                    poldi1405poldi1405

                    364 bronze badges




                    364 bronze badges


























                        0



















                        First validate that the configuration files are valid:



                        sudo nginx -t


                        Apply the changes without restarting the Nginx service:



                        sudo nginx -s reload


                        If the changes are not applied immediately, restart the service with the following command (unlike the command used in the previous step, it will abruptly close all web client connections):



                        sudo systemctl restart nginx


                        In the extreme case, you can kill the process and start it again with:



                        sudo pkill -9 nginx && sudo systemctl start nginx


                        In some cases Nginx may fail to restart because some child processes or another process (Apache or httpd) are using port 80 or 443. In these cases I recommend stopping Nginx (sudo systemctl stop nginx) and validate if any process continues to listen in the port 80:



                        sudo netstat -ant | grep ": 80"


                        You can see more details with:



                        sudo lsof -i -P -n | grep ": 80"


                        To see the running processes more easily you can use htop.



                        When nobody is using the TCP/80 port, you can start Nginx again:



                        sudo systemctl start nginx





                        share|improve this answer































                          0



















                          First validate that the configuration files are valid:



                          sudo nginx -t


                          Apply the changes without restarting the Nginx service:



                          sudo nginx -s reload


                          If the changes are not applied immediately, restart the service with the following command (unlike the command used in the previous step, it will abruptly close all web client connections):



                          sudo systemctl restart nginx


                          In the extreme case, you can kill the process and start it again with:



                          sudo pkill -9 nginx && sudo systemctl start nginx


                          In some cases Nginx may fail to restart because some child processes or another process (Apache or httpd) are using port 80 or 443. In these cases I recommend stopping Nginx (sudo systemctl stop nginx) and validate if any process continues to listen in the port 80:



                          sudo netstat -ant | grep ": 80"


                          You can see more details with:



                          sudo lsof -i -P -n | grep ": 80"


                          To see the running processes more easily you can use htop.



                          When nobody is using the TCP/80 port, you can start Nginx again:



                          sudo systemctl start nginx





                          share|improve this answer





























                            0















                            0











                            0









                            First validate that the configuration files are valid:



                            sudo nginx -t


                            Apply the changes without restarting the Nginx service:



                            sudo nginx -s reload


                            If the changes are not applied immediately, restart the service with the following command (unlike the command used in the previous step, it will abruptly close all web client connections):



                            sudo systemctl restart nginx


                            In the extreme case, you can kill the process and start it again with:



                            sudo pkill -9 nginx && sudo systemctl start nginx


                            In some cases Nginx may fail to restart because some child processes or another process (Apache or httpd) are using port 80 or 443. In these cases I recommend stopping Nginx (sudo systemctl stop nginx) and validate if any process continues to listen in the port 80:



                            sudo netstat -ant | grep ": 80"


                            You can see more details with:



                            sudo lsof -i -P -n | grep ": 80"


                            To see the running processes more easily you can use htop.



                            When nobody is using the TCP/80 port, you can start Nginx again:



                            sudo systemctl start nginx





                            share|improve this answer
















                            First validate that the configuration files are valid:



                            sudo nginx -t


                            Apply the changes without restarting the Nginx service:



                            sudo nginx -s reload


                            If the changes are not applied immediately, restart the service with the following command (unlike the command used in the previous step, it will abruptly close all web client connections):



                            sudo systemctl restart nginx


                            In the extreme case, you can kill the process and start it again with:



                            sudo pkill -9 nginx && sudo systemctl start nginx


                            In some cases Nginx may fail to restart because some child processes or another process (Apache or httpd) are using port 80 or 443. In these cases I recommend stopping Nginx (sudo systemctl stop nginx) and validate if any process continues to listen in the port 80:



                            sudo netstat -ant | grep ": 80"


                            You can see more details with:



                            sudo lsof -i -P -n | grep ": 80"


                            To see the running processes more easily you can use htop.



                            When nobody is using the TCP/80 port, you can start Nginx again:



                            sudo systemctl start nginx






                            share|improve this answer















                            share|improve this answer




                            share|improve this answer








                            edited Oct 2 at 9:34









                            user3140225

                            2,7104 gold badges12 silver badges24 bronze badges




                            2,7104 gold badges12 silver badges24 bronze badges










                            answered Aug 1 at 9:14









                            NEOhitokiriNEOhitokiri

                            1012 bronze badges




                            1012 bronze badges
























                                0



















                                try this, it's for as root user check the service, disable, enable again and start.



                                sudo -i
                                systemctl check nginx
                                systemctl disable nginx
                                systemctl enable nginx
                                systemctl start nginx





                                share|improve this answer





























                                  0



















                                  try this, it's for as root user check the service, disable, enable again and start.



                                  sudo -i
                                  systemctl check nginx
                                  systemctl disable nginx
                                  systemctl enable nginx
                                  systemctl start nginx





                                  share|improve this answer



























                                    0















                                    0











                                    0









                                    try this, it's for as root user check the service, disable, enable again and start.



                                    sudo -i
                                    systemctl check nginx
                                    systemctl disable nginx
                                    systemctl enable nginx
                                    systemctl start nginx





                                    share|improve this answer














                                    try this, it's for as root user check the service, disable, enable again and start.



                                    sudo -i
                                    systemctl check nginx
                                    systemctl disable nginx
                                    systemctl enable nginx
                                    systemctl start nginx






                                    share|improve this answer













                                    share|improve this answer




                                    share|improve this answer










                                    answered Oct 2 at 11:05









                                    SauloSaulo

                                    1




                                    1































                                        draft saved

                                        draft discarded















































                                        Thanks for contributing an answer to Ask Ubuntu!


                                        • 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.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1146244%2fnginx-not-restarting%23new-answer', 'question_page');

                                        );

                                        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









                                        Popular posts from this blog

                                        Tamil (spriik) Luke uk diar | Nawigatjuun

                                        Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                                        Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?