Cannot externally access the nginx web server that is booting on port 80

Asked 2 years ago, Updated 2 years ago, 70 views

I started nginx on port 80 and configured it as follows, but for some reason it is not accessible from the outside.

External access is verified by cman.jp.

The router is open to port.
lsof-i:80 does not show nginx.When I tried sudo, it came out.

  • environment

    • Mac OS X Yosemite (10.10)

    • nginx v1.6.2 (installed with homebrew)


  • Mac OS X Yosemite (10.10)

  • nginx v1.6.2 (installed with homebrew)

sudolsof-i:80

nginx39791 root6u IPv40x940c44dd2ca1aa210t0TCP*:http (LISTEN)
nginx39792 nobody6u IPv40x940c44dd2ca1aa210t0TCP*: http (LISTEN)
nginx39793 nobody6u IPv40x940c44dd2ca1aa210t0TCP*: http (LISTEN)
nginx39794 nobody6u IPv40x940c44dd2ca1aa210t0TCP*: http (LISTEN)
nginx39795 nobody6u IPv40x940c44dd2ca1aa210t0TCP*: http (LISTEN)

nginx.conf

worker_processes auto;
error_log/usr/local/etc/nginx/logs/error.log info;

events {
    worker_connections1024;
}

US>http{
  include mime.types;
  default_type application/octet-stream;

  log_format main'$remote_addr-$remote_user[$time_local]"$request"'
                    '$status$body_bytes_sent"$http_refer"'
                    '''$http_user_agent''''$http_x_forwarded_for";

  access_log/usr/local/etc/nginx/logs/access.log main;

  sendfile on;
  keepalive_timeout65;

  server{
    listen* —80;
    server_name hoge.example.asia;

    location / {
      root/Users/seioo/Devs/Web/;
      index index.html index.htm;
      autoindex on;
    }
  }
}

macos nginx

2022-09-30 20:34

1 Answers

Superuser had a similar question.

I think the reason is that the firewall cannot be unblocked with symbolic links.
I think it will be cured if you add it manually from the setting or with the following command.

 sudo/usr/libexec/ApplicationFirewall/socketfilterfw --add`readlink\`whichnginx\``
sudo/usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp`readlink\`which nginx\``

It's a bit troublesome that I have to fix it every time I upgrade the version...


2022-09-30 20:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.