- Stopping nginx server on Mac OS X Lion once and for all
- 2 Answers 2
- Not the answer you’re looking for? Browse other questions tagged nginx or ask your own question.
- Related
- Hot Network Questions
- Subscribe to RSS
- Корректная настройка Nginx в Mac OS?
- jimothyGator / README.md
- This comment has been minimized.
- spamguy commented Sep 25, 2015
- This comment has been minimized.
- Vetal4eg commented Oct 1, 2015
- This comment has been minimized.
- anthonybrown commented Oct 13, 2015
- This comment has been minimized.
- wellington1993 commented Mar 30, 2016
- This comment has been minimized.
- andresnator commented May 28, 2016
- This comment has been minimized.
- iplus26 commented Jun 7, 2016
- This comment has been minimized.
- raulvillca commented Aug 14, 2016
- This comment has been minimized.
- cr2121 commented Sep 20, 2016
- This comment has been minimized.
- craigiswayne commented Dec 19, 2016
- This comment has been minimized.
- j0t3x commented Dec 26, 2016
- This comment has been minimized.
- sivcan commented Jan 19, 2017
- This comment has been minimized.
- trainiac commented Jan 22, 2017
- This comment has been minimized.
- Oliboy50 commented Feb 1, 2017
- This comment has been minimized.
- nyxee commented Aug 25, 2017
- This comment has been minimized.
- ihorvorotnov commented Feb 22, 2018
- This comment has been minimized.
- efthemiosprime commented Mar 25, 2018
- This comment has been minimized.
- agm1984 commented Oct 11, 2018 •
- How to restart Nginx on Mac OS X?
- 9 Answers 9
- Not the answer you’re looking for? Browse other questions tagged mac-osx nginx mac or ask your own question.
- Related
- Hot Network Questions
- Subscribe to RSS
- Настройка окружения для web-разработки на Mac OS X
- Установка Homebrew
- Cтавим MariaDB:
- Займемся web сервером nginx:
- Настройка nginx и создание структуры директорий.
- Конфигурационные файлы вирутальных хостов.
- Установка PHP
Stopping nginx server on Mac OS X Lion once and for all
I’ve tried sending the signal down nginx. I’ve tried killing all the processes, but they seem to just come back.
I’ve already tried killing those processes, but they just show up again.
How do I stop nginx once and for all?
2 Answers 2
You got you answer, but just to be clear and maybe help others:
OS X should be restarting the nginx process for you (running it as a system service, which is what you want most of the time). So you need to tell launchd to stop managing this process for you with the command sudo launchctl unload
, where in my case is:
sudo launchctl unload /Library/LaunchDaemons/dev.nginx.plist
daemondo is restarting nginx.
Unfortunately there isn’t much information about using it online and I don’t have it installed on this computer, however daemondo —help should provide some pointers about how to stop it restarting nginx .
Not the answer you’re looking for? Browse other questions tagged nginx or ask your own question.
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
Корректная настройка Nginx в Mac OS?
Здравствуйте, помогите пожалуйста разобраться!
Пытаюсь настроить Nginx в Mac OS.
В /usr/local/etc/nginx/servers/ создаю файл mysite_nginx.conf . В /private/etc/host добавил 127.0.0.1 mysite . Запускаю Nginx, захожу по url mysite:8888, а статика не отображается.
Команда nginx -t :
P.S. До этого использовал Nginx лишь в Ubuntu 16.04, где кастомные настройки для своего проекта создавались в папке /etc/nginx/sites-available/mysite_nginx.conf .
- Вопрос задан более трёх лет назад
- 8422 просмотра
Nginx слушает 80 порт, но вы продожаете ходить в 8888, т.е. мимо nginx.
А вообще, nginx точно запустился, а то сообщения об ошибках вообще-то не совместимы с нормальной работой.
Алексей Тен, вы правы я обращаясь по порту 8888 в url я проходил мимо Nginx. Написал в url-ке mysite без порта и все открылось как надо. На счет ошибок не могу сам понять в чем проблема. Проверил файлы error.log и nginx.pid по указанным адресам и они существуют. Заходил в файл /usr/local/etc/nginx/nginx.conf и там были закоментированы следующие поля:
Я их разкомментировал, и перезагрузил nginx (Команда sudo nginx -s reload).
Запустил команду nginx -t но к сожалению выдает те же ошибки. Есть идеи как исправить ситуацию?
Тестировать тоже надо используя sudo
Алексей Тен, В чем существенная разница между sudo nginx -t и nginx -t ? Понятно sudo выполняет команду от имени администратора.
Без sudo не хватает прав на открытие файлов логов.
Источник
jimothyGator / README.md
- nginx.conf to /usr/local/etc/nginx/
- default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
- homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
Not documented yet:
- How to create self-signed SSL certificates
- How to start and stop Nginx
server < |
listen 443; |
server_name localhost; |
ssl on; |
ssl_certificate server.crt; |
ssl_certificate_key server.key; |
ssl_session_timeout 5m; |
ssl_protocols SSLv2 SSLv3 TLSv1; |
ssl_ciphers HIGH:!aNULL:!MD5; |
ssl_prefer_server_ciphers on; |
location / < |
root html; |
index index.html index.htm; |
> |
> |
server < |
listen 80; |
server_name localhost; |
#access_log logs/host.access.log main; |
location / < |
root html; |
index index.html index.htm; |
> |
#error_page 404 /404.html; |
# redirect server error pages to the static page /50x.html |
# |
error_page 500 502 503 504 /50x.html; |
location = /50x.html < |
root html; |
> |
> |
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/sbin/nginx string > |
string > -g string > |
string > daemon off; string > |
array > |
key > WorkingDirectory key > |
string > /usr/local string > |
dict > |
plist > |
#user nobody; |
worker_processes 1 ; |
error_log /Library/Logs/nginx/error.log; |
events < |
worker_connections 1024 ; |
> |
http < |
include mime.types; |
default_type application/octet-stream; |
log_format main ‘ $remote_addr — $remote_user [ $time_local ] » $request » ‘ |
‘ $status $body_bytes_sent » $http_referer » ‘ |
‘» $http_user_agent » » $http_x_forwarded_for «‘ ; |
access_log /Library/Logs/nginx/access.log main ; |
sendfile on ; |
keepalive_timeout 65 ; |
index index.html index.php; |
upstream www-upstream-pool < |
server unix:/tmp/php-fpm.sock; |
> |
include /etc/nginx/conf.d/*.conf; |
include /usr/local/etc/nginx/sites-enabled/*.conf; |
> |
This comment has been minimized.
Copy link Quote reply
spamguy commented Sep 25, 2015
Good idea putting the logs in /Library/Logs. I had to create the directory /Library/Logs/nginx first—nginx couldn’t handle that itself.
This comment has been minimized.
Copy link Quote reply
Vetal4eg commented Oct 1, 2015
@spamguy What good in logs at /Library/Logs? Only unix way, only hardcore!
This comment has been minimized.
Copy link Quote reply
anthonybrown commented Oct 13, 2015
I can’t seem to get nginx to load anything on port :8080
brew install nginx —with-passenger
followed brew’s instructions but couldn’t get localhost to work.
I have it running on my iMac but not on my MBP, is there some difference in configuration?
This comment has been minimized.
Copy link Quote reply
wellington1993 commented Mar 30, 2016
This comment has been minimized.
Copy link Quote reply
andresnator commented May 28, 2016
This comment has been minimized.
Copy link Quote reply
iplus26 commented Jun 7, 2016
You saved my day.
Forgot to include /usr/local/etc/nginx/sites-enabled/*.conf;
This comment has been minimized.
Copy link Quote reply
raulvillca commented Aug 14, 2016
include /etc/nginx/conf.d . i must make it, cause i didn’t find it
This comment has been minimized.
Copy link Quote reply
cr2121 commented Sep 20, 2016
This comment has been minimized.
Copy link Quote reply
craigiswayne commented Dec 19, 2016
Found this «create your own signed certificate for mac» tutorial
https://certsimple.com/blog/localhost-ssl-fix
This comment has been minimized.
Copy link Quote reply
j0t3x commented Dec 26, 2016
This comment has been minimized.
Copy link Quote reply
sivcan commented Jan 19, 2017
Thanks a lot dude!
This comment has been minimized.
Copy link Quote reply
trainiac commented Jan 22, 2017
/usr/local/opt/nginx/sbin/nginx was /usr/local/opt/nginx/bin/nginx for me. Thanks!
This comment has been minimized.
Copy link Quote reply
Oliboy50 commented Feb 1, 2017
This comment has been minimized.
Copy link Quote reply
nyxee commented Aug 25, 2017
people always fail to inform others to edit /private/etc/hosts and add entries for the servers.
This comment has been minimized.
Copy link Quote reply
ihorvorotnov commented Feb 22, 2018
@nyxee or just let dnsmasq handle it
This comment has been minimized.
Copy link Quote reply
efthemiosprime commented Mar 25, 2018
where can i find the /private/etc/hosts?
This comment has been minimized.
Copy link Quote reply
agm1984 commented Oct 11, 2018 •
The hosts files is found at /etc/hosts in both Mac OS and Unix systems.
Typically, you can type
and it will open the file, if you have nano installed. There is a good chance you have nano installed. Try it, if not, use your favourite text editor. Make sure you open the file with elevated privileges so you can save it. It is a system file.
As mentioned above, you can also use dnsmasq which auto forwards *.dev domains in your browser to localhost.
Источник
How to restart Nginx on Mac OS X?
I just installed Nginx on Mac OS X (thanks http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/), but how do I restart Nginx on Mac OS X?
9 Answers 9
For a one-liner, you could just do:
The -s options stands for signal, and is the option you’ll use to send stop , quit , reopen and reload signals to nginx.
For more info on the options, just do nginx -h for a list of all of them and their functions.
for brew installation: sudo brew services restart nginx
If the pkill can’t be found, then install it using brew install proctools first.
If you are using brew:
To see all services:
Start nginx service:
Stop nginx Service:
sudo nginx -s quit && sudo nginx
Using MAMP and Nginx? Then you have an installed script:
Just another note, if you want to start nginx with launchctl, when your Mac boots up, you can do as follows:
In short, you need to put your plist file in /Library/LaunchDaemons , not in
/Library/LaunchAgents like the Homebrew instructions. Finally, use the -w option with launchctl . For further information, follow this guide.
If you installed nginx with brew and you started it as a service brew services start nginx then you can issue: brew services restart nginx
Not the answer you’re looking for? Browse other questions tagged mac-osx nginx mac or ask your own question.
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
Настройка окружения для web-разработки на Mac OS X
Установку необходимого софта будем производить с использованием менеджера недостающих пакетов для macOS — Homebrew. Если он у вас еще не устанолен, сперва ставим Xcode через AppStore либо в терминале набираем команду:
согласившись с лицензионным соглашением.
Установка Homebrew
Открываем терминал (вместо стандартного я использую ITerm2) и запускаем установку командой:
После установки обновляемся, проверяем все ли в порядке:
В качестве сервера баз данных я решил использовать MariaDB.
Cтавим MariaDB:
Выпоним первоначальную настройку сервера:
и проверяем подключение:
Займемся web сервером nginx:
Настройка nginx и создание структуры директорий.
Для виртуальных хостов я использую следующую структуру (вы можете использовать другую, удобную вам но не забудьте исправить пути в конфигах!):
Конфигурационные файлы вирутальных хостов.
Я использую следующую схему:
После установки nginx, в директории /usr/local/etc/nginx/ имеется стандартный конфигурационный файл nginx.conf. Приведем его к следуюущему виду:
Далее пишем конфигурацию виртуального хоста в директории /usr/local/etc/nginx/sites-available/
Создаем символьную ссылку:
Установка PHP
Если используете zsh то:
либо (в зависимости от того какой используется шел)
Версии должны быть одинаковыми!
Далее создадим файл index.php для проверки:
В адресной строке браузера набираем localhost и смотрим результат. Чтобы сервисы автоматически запускались после перезагрузки:
Вот вроде бы и все. Если возникнут вопросы, пишите в комментариях либо через форму обратной связи на странице контактов.
Источник