日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

mac brew install nginx遇到的坑

發(fā)布時間:2024/7/19 编程问答 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mac brew install nginx遇到的坑 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

默認使用 brew install nginx?出現(xiàn)了一下的錯誤:

?

localhost:testdj newstart$ brew install nginx

==> Installing dependencies for nginx: openssl, pare

==> Installing nginx dependency: openssl

==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2n.high_sierra.

######################################################################## 100.0%

==> Pouring openssl-1.0.2n.high_sierra.bottle.tar.gz

Error: Failed to create /usr/local/opt/openssl

Things that depend on openssl will probably not build.

Could not symlink .

/usr/local/opt is not writable.

Warning: The post-install step did not complete successfully

You can try again using `brew postinstall openssl`

==> Caveats

A CA file has been bootstrapped using certificates from the SystemRoots

keychain. To add additional certificates (e.g. the certificates added in

the System keychain), place .pem files in

? /usr/local/etc/openssl/certs

?

and run

? /usr/local/opt/openssl/bin/c_rehash

?

This formula is keg-only, which means it was not symlinked into /usr/local,

because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

?

If you need to have this software first in your PATH run:

? echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

?

For compilers to find this software you may need to set:

? ? LDFLAGS:? -L/usr/local/opt/openssl/lib

? ? CPPFLAGS: -I/usr/local/opt/openssl/include

?

==> Summary

?? /usr/local/Cellar/openssl/1.0.2n: 1,792 files, 12.3MB

==> Installing nginx dependency: pcre

==> Downloading https://homebrew.bintray.com/bottles/pcre-8.41.high_sierra.bottl

######################################################################## 100.0%

==> Pouring pcre-8.41.high_sierra.bottle.tar.gz

Error: The `brew link` step did not complete successfully

The formula built, but is not symlinked into /usr/local

Could not symlink .

/usr/local/opt is not writable.

?

You can try again using:

? brew link pcre

==> Summary

?? /usr/local/Cellar/pcre/8.41: 204 files, 5.3MB

==> Installing nginx

==> Downloading https://homebrew.bintray.com/bottles/nginx-1.12.2_1.high_sierra.

######################################################################## 100.0%

==> Pouring nginx-1.12.2_1.high_sierra.bottle.tar.gz

Error: The `brew link` step did not complete successfully

The formula built, but is not symlinked into /usr/local

Could not symlink .

/usr/local/opt is not writable.

?

You can try again using:

? brew link nginx

Warning: The post-install step did not complete successfully

You can try again using `brew postinstall nginx`

==> Caveats

Docroot is: /usr/local/var/www

?

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that

nginx can run without sudo.

?

nginx will load all files in /usr/local/etc/nginx/servers/.

?

To have launchd start nginx now and restart at login:

? brew services start nginx

Or, if you don't want/need a background service you can just run:

? nginx

==> Summary

?? /usr/local/Cellar/nginx/1.12.2_1: 25 files, 1MB

localhost:testdj newstart$ /usr/local/webserver/nginx/sbin/nginx -v

-bash: /usr/local/webserver/nginx/sbin/nginx: No such file or directory

localhost:testdj newstart$ /usr/local/Cellar/nginx/sbin/nginx -v

-bash: /usr/local/Cellar/nginx/sbin/nginx: No such file or directory

localhost:testdj newstart$ brew postinstall nginx

==> Postinstalling nginx

Error: Permission denied @ dir_s_mkdir - /usr/local/etc

localhost:testdj newstart$ sudo chown -R $(whoami) /usr/local/etc/

chown: /usr/local/etc/: No such file or directory

localhost:testdj newstart$ sudo chown -R $(whoami) /usr/local

chown: /usr/local: Operation not permitted

localhost:testdj newstart$ sudo chown -R $(whoami) /usr/local/

chown: /usr/local/: Operation not permitted

localhost:testdj newstart$ nginx

-bash: nginx: command not found

localhost:testdj newstart$ sudo nginx

sudo: nginx: command not found

localhost:testdj newstart$?

?

?

然后就是浩浩蕩蕩的解決之路:

?

首先如果出現(xiàn)一些目錄沒有權限的問題:直接使用??sudo chown -R $(whoami) /usr/local/opt(這個目錄就是需要賦予權限的目錄),往后所有需要給目錄賦權限的使用,直接使用這個,比如,提示Error:?Failed to create /usr/local/opt/openssl?直接使用上面的命令

?

1. openssl 無法link成功

在試過很多方法之后,比如 添加 --force 參數(shù),仍舊無解的情況下,google給了我希望

刪除 /usr/local/Cellar/openssl路徑,可是刪除之后重新使用 brew install openssl 仍舊失敗

繼續(xù),刪除?rm -rf /usr/local/opt/openssl

重新使用 brew install openssl。成功

2. 啟動nginx 仍舊失敗

查看只有發(fā)現(xiàn)是 沒有 link pcre

使用命令:brew link pcre

3. 這樣修改之后,仍舊失敗

啟動后,顯示

nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (2: No such file or directory)

2017/12/26 15:47:00 [emerg] 36666#0: open() "/usr/local/nginx/conf/nginx.conf" failed (2: No such file or directory)

這個時候,執(zhí)行 brew postinstall nginx

解決

4. 訪問 localhost:8080 顯示成功

?

轉載于:https://www.cnblogs.com/loveyangaddddd/p/8118501.html

總結

以上是生活随笔為你收集整理的mac brew install nginx遇到的坑的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。