macos - Pemasangan brew Nginx tidak boleh dimulakan melalui Launchctl?
迷茫
迷茫 2017-05-16 17:28:06
0
1
815

Ia tidak berfungsi apabila saya mula-mula memasangnya, dan ia tidak berfungsi apabila saya menukarnya kepada versi pembangunan:

brew install nginx
brew upgrade --devel nginx

Oleh launchctl 命令来启动, 还试过多次 unloadload:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

Kandungan fail konfigurasi ialah:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>homebrew.mxcl.nginx</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/opt/nginx/bin/nginx</string>
        <string>-g</string>
        <string>daemon off;</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/usr/local</string>
  </dict>
</plist>

Saya melihat ralat semasa mendengar log, tetapi saya tidak dapat melihat maklumat khusus:

➤➤ tail -f /var/log/system.log
Feb 20 18:28:14 Air com.apple.launchd.peruser.501[244] (homebrew.mxcl.nginx[1200]): Exited with code: 1

Selain itu, secara manual sudo nginx atau laluan dalam fail konfigurasi adalah betul,
Membandingkan kod Homebrew pada GitHub, konfigurasi Nginx saya seharusnya tidak salah...
https://github.com/Homebrew/homebrew/blob/master/Library/Formula/nginx.rb#L138

Kebenaran untuk melihat fail sekarang ialah:

➤➤ ls -l /usr/local/opt/nginx/bin/nginx
-r-xr-xr-x  1 chen  admin  675992 Feb 11 10:16 /usr/local/opt/nginx/bin/nginx
➤➤ l -l /usr/local/Cellar/nginx/1.5.8/bin/nginx
-r-xr-xr-x  1 chen  admin  675992 Feb 11 10:16 /usr/local/Cellar/nginx/1.5.8/bin/nginx

Kebenaran yang ditulis dalam visudo ialah:

 32
 33 # User privilege specification
 34 root    ALL=(ALL) ALL
 35 %admin  ALL=(ALL) ALL
 36
 37 # Uncomment to allow people in group wheel to run all commands
 38 # %wheel        ALL=(ALL) ALL
 39
 40 # Same thing without a password
 41 # %wheel        ALL=(ALL) NOPASSWD: ALL
 42 chen ALL=(ALL) NOPASSWD: ALL

Tolong beri saya nasihat...


chmod u+s Tidak berjaya..

➤➤ sudo chmod u+s /usr/local/Cellar/nginx/1.5.8/bin/nginx
➤➤ ps aux | grep nginx
nobody           7254   0.0  0.0  2458140    916   ??  S     7:49PM   0:00.00 nginx: worker process
root             7253   0.0  0.0  2448924    360   ??  Ss    7:49PM   0:00.00 nginx: master process nginx
chen             7293   0.0  0.0  2432784    604 s002  S+    7:52PM   0:00.00 grep nginx
➤➤ sudo nginx -s stop
➤➤ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
homebrew.mxcl.nginx: Already loaded
➤➤ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
➤➤ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
➤➤ ps aux | grep nginx
chen             7316   0.0  0.0  2432784    608 s002  S+    7:52PM   0:00.00 grep nginx
➤➤ sudo nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
➤➤ nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
➤➤ sudo chmod u-s /usr/local/Cellar/nginx/1.5.8/bin/nginx
➤➤ nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
➤➤ sudo nginx
➤➤
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

membalas semua(1)
为情所困

Ini mungkin masalah dengan kebenaran pelaksanaan nginx, lihat artikel ini.

sudo chown root:wheel /usr/local/Cellar/nginx/1.2.6/sbin/nginx
sudo chmod u+s /usr/local/Cellar/nginx/1.2.6/sbin/nginx
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan