Setting up a local web server on macOS 10.13 "High Sierra"
Here is my definitive guide to getting a local web server running on macOS 10.13 “High Sierra”. This is meant to be a development platform so that you can build and test your sites locally, then deploy to an internet server. This User Tip only contains instructions for configuring the Apache server, PHP module, and Perl module. I have another User Tip for installing and configuring MySQL and email servers.
Note: This user tip is specific to macOS 10.13 “High Sierra”. Pay attention to your OS version. There have been significant changes since earlier versions of macOS. Another note: These instructions apply to the client versions of OS X, not Server. Server does a few specific tricks really well and is a good choice for those. For things like database, web, and mail services, I have found it easier to just setup the client OS version manually.
- Basic understanding of Terminal.app and how to run command-line programs.
- Basic understanding of web servers.
- Basic usage of vi. You can substitute nano if you want.
Xcode is required for adding PHP modules.
Lines in bold are what you will have to type in. Lines in bold courier should be typed at the Terminal.
Replace with your short user name.
Here goes. Enjoy!
To get started, edit the Apache configuration file as root:
sudo vi /etc/apache2/httpd.conf
Enable PHP by uncommenting line 177, changing:
#LoadModule php7_module libexec/apache2/libphp7.so
LoadModule php7_module libexec/apache2/libphp7.so
(If you aren’t familiar with vi, go to line 177 by typing «176G» (without the quotes). Then just press ‘x’ over the ‘#’ character to delete it. Then type ‘:w!’ to save, or just ‘ZZ’ to save and quit. Don’t do that yet though. More changes are still needed.)
If you want to run Perl scripts, you will have to do something similar:
Enable Perl by uncommenting line 178, changing:
#LoadModule perl_module libexec/apache2/mod_perl.so
LoadModule perl_module libexec/apache2/mod_perl.so
Enable personal websites by uncommenting the following at line 174:
#LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
and do the same at line 511:
Include /private/etc/apache2/extra/httpd-userdir.confNow save and quit.
Open the file You just enabled above with:
sudo vi /etc/apache2/extra/httpd-userdir.conf
and uncomment the following at line 16:
Lion and later versions no longer create personal web sites by default. If you already had a Sites folder in Snow Leopard, it should still be there. To create one manually, enter the following:
Источник
Установка MacOS High Sierra, когда под рукой только WiFi
Итак, у меня случилась ситуация, которая заставила меня попотеть, так как подробной инструкции не нашёл нигде. Сам себе создал проблем.
Уехал заграницу, с одной сумкой, из техники был только телефон) Думал куплю ноут на месте, чтоб не таскаться. В итоге купил первый свой, на мой взгляд неплохой MacBook Pro 8,2 2011 года, i7-2635QM, DDR3 8GB, 256SSD. До этого были обычные ноутбуки на BIOS с Windows, на которых уже собаку съел, решил перейти на Apple, так как телефоном очень доволен. Была установлена High Sierra, версию не помню, но не суть. Решил я значит, что от прежнего владельца где-то что-то осталось, пароли и т.п. Думаю сброшу ка я всё в ноль , как на телефоне, предполагал просто зайду в настройки и выберу стереть все настройки и контент, но такой функции не оказалось… Ну я ж Админ всё-таки, сложности меня не останавливают, полез в интернет, начал читать как сбросить мак. Нашёл какую-то статью, полностью не прочитав начал выполнять по пунктам:
- Зайти в режим Recovery (Command (⌘) – R)
- Открыть дисковую утилиту
- Выбрать ЖД и стереть его.
Дальше я что-то отвлёкся, когда вернулся ноут уже был выключен, запускаю его, яблочка нет, ОС стерлась, думаю отлично, сейчас из режима Recovery продолжу установку. Захожу в режим Recovery, а он уже не тот, получается, когда я стёр ЖД, я стёр и область Recovery High Sierra, и у меня с интернета загрузилась версия для моего ноута Recovery Lion. Думаю ладно, будет родная система, тупить не будет)) Уже в интернете нашел как устанавливать OS, на всякий случай чтоб снова не напороть. Нажимаю установить OS X Lion, дохожу до пункта авторизации, ввожу свой AppleID и пароль и тут начались проблемы) Первое, у меня двухфакторная аутентификация, на телефон приходит код, а на ноутбуке окно для ввода не появляется, просто высвечивается что пароль не правильный. Вот такое сообщение:
Ищу снова в интернете, оказывается проблема не новая, и есть решение, нужно на телефоне получить код (https://support.apple.com/ru-ru/HT204974), я это делал в «Настройки → [ваше имя] → Пароль и безопасность → Получить код проверки».
После получения кода проверки, на ноутбуке нужно снова ввести учётный данные AppleID и пароль, но пароль уже в изменённом виде. К примеру, у вас пароль 12345678, а код проверки 333-333, значит в поле пароля нужно ввести пароль в виде 12345678333333, без пробелов и тире. Итак, победил эту проблему, и уже жду что сейчас установится новая система, и тут «Какая неожиданность», снова проблема «This item is temporarily unavailable. Please try again later.»
Установку продолжить невозможно, напоминаю у меня только Mac и iPhone. Ищу как пофиксить этот баг. Всего 4 варианта:
- Попробовать использовать AppleID с которым впервые вошли в этот макбук (сразу отбросил этот вариант, дергать предыдущего владельца не хотел, так как был на 90% уверен, что не сработает, либо он не первый владелец, либо даже если войти толку будет ноль. )
- Изменить дату через терминал (проверил, дата в норме, пробовал изменить толку тоже ноль)
- Через Safari в режиме Recovery войти на сайт iCloud.com под своим AppleID, и попробовать повторно продолжить установку. Попробовал, сайт Apple говорит браузер не поддерживается
- Internet Recovery, режим в котором я нахожусь.
То есть на этом варианты заканчиваются. Я уже расстроенный, сижу смотрю как восстановить MacBook, нахожу варианты только из-под Windows костылями создавать USB с MacOS, и пробовать устанавливать. Меня такой вариант не устраивал, во-первых, у меня не было где взять другой компьютер, во-вторых, меня не устраивал вариант с неофициальной OS.
Несколько дней искал в интернете как можно поставить MacOS, не имея второго MacBook или второго ПК под рукой. Перечитал уйму статей, нашёл статью которая очень была мне близка, но у парня был второй ноут, хотя принцип установки я всё же частично использовал (https://habr.com/ru/post/199164/). Сами файлы системы я загрузил с официального сайта Apple, нашёл в интернете официальные ссылки на файлы установщика. Всю адресную строку вписывал вручную.
Итак, что именно я делал (ниже опишу способ как всё можно сделать совсем без флешки, к этому я уже позже догадался, когда лучше разобрался в системе):
1. Пошёл и купил флешку на 32ГБ, можно и на 16ГБ (она нужна для установщика).
2. Загружаемся в режиме Internet Recovery (Command (⌘) – Option (⌥) – R).
3. Запускаем «Дисковую утилиту» и форматируем наш ЖД (У меня имя ЖД Macintosh HD) и флешку с такими параметрами.
4. Далее можно было бы из терминала скачать образ, но увы, Recovery режим MacOS Lion не поддерживает элементарную команду «curl» для загрузки файлов с интернета, потому нашёл другой выход.
Открываем Safari, в верхнем меню переходим «Safari → Настройки → Сохранять загруженное в папке», и выбираем наш ЖД.
5. Закрываем настройки и в адресной строке вводим адрес:
Нажимаем «Enter» и ждём, когда загрузится необходимый образ.
6. Закрываем Safari в верхнем меню «Safari → Завершить Safari» и открываем «Утилиты → Терминал»
7. Далее монтируем образ «OS X Base System». Вводим в терминале следующую команду:
hdiutil mount /Volumes/Macintosh\ HD/BaseSystem.dmg
(отклоняясь немного от темы, косая черта слева направо означает пробел в названии, то есть данную команду можно ввести ещё так: hdiutil mount “/Volumes/Macintosh HD/BaseSystem.dmg”)
Ждём пока образ монтируется.
8. Далее в верхнем меню «Терминал → Завершить терминал»
9. Снова открываем «Дисковую утилиту» и восстанавливаем загрузчик на нашу флешку как на скриншоте (Обратите внимание что при восстановлении мы выбираем источник сам образ, а не раздел, а назначение – раздел флешки):
10. Ну вот мы подготовили флешку и можем перезагружать ноутбук с нажатой клавишей Option (⌥), в списке появится наша флешка, загружаемся с неё.
11. Попадаем в режим Recovery, но уже Mac OS High Sierra, и просто выбираем «Установка macOS».
Дальше всё уже идёт отлично, никаких проблем уже не должно возникнуть.
Вариант для тех, у кого нет возможности купить флешку.
Действия идентичные, только мы в дисковой утилите разбиваем наш ЖД на два раздела, один делаем 16 ГБ, для установщика, желательно его добавить в конец ЖД если есть такой выбор. Далее действия те же, качаем образ на основной раздел, монтируем, восстанавливаем его уже не на флешку, а выбираем созданный нами раздел на 16ГБ на ЖД. После перезагрузки с нажатой клавишей Option (⌥), в списке появится наш раздел для восстановления, загружаемся с него и устанавливаем OS на основной раздел.
Всем приятного дня (или ночи). Надеюсь, моя статья окажется полезной.
Источник
Question: Q: FTP server, Mac OS High Sierra
Pre-High Sierra, I was able to run an FTP server through the command line:
«sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist»
Fast forward, I’ve installed High Sierra, and I can’t use that command anymore. I’ve also downloaded and installed Mac OS Server, but I don’t see it as a service there either.
Any suggestions to run an FTP server locally on my Mac? I’d prefer a command-line solution like I started with once upon a time.
P.S. I’ve also tried the following file sharing solution with the -F option (for FTP) with no luck:
MacBook Pro with Retina display, macOS High Sierra (10.13), null
Posted on Sep 27, 2017 11:22 AM
Helpful answers
Yes, the /usr/bin/ftp and telnet images work just fine when copied to /usr/local/bin.
I cannot believe Momma Apple, citing «Security Issues», would remove two of the most basic tools from the Internet Suite, used by literally tens of thousands of CORPORATE applications. By bringing over the 12.x utilities, we now are dependent on images which will no longer have support, ie, will no longer receive security updates the rest of the internet gets. This is better HOW.
(40+ year veteran of supporting commercial legacy systems as a consultant for a major computer manufacturer)
Dec 6, 2017 8:08 AM
I read somewhere else that both telnet and ftp were removed from high sierra.
One suggestion, if you still have the old sierra around, you can use the binaries from it. Probably use /usr/local/bin rather than screwing with the SIP stuff to stick them where they belong.
I haven’t tried it myself but it’s supposed to work fine.
Dec 6, 2017 7:23 AM
There’s more to the conversation
Loading page content
Page content loaded
Refer to the Implementation section.
Sep 27, 2017 11:26 AM
I looked at it, but I don’t know how it answers my question. Can you clarify what it’s stating?
Sep 27, 2017 11:37 AM
I read somewhere else that both telnet and ftp were removed from high sierra.
One suggestion, if you still have the old sierra around, you can use the binaries from it. Probably use /usr/local/bin rather than screwing with the SIP stuff to stick them where they belong.
I haven’t tried it myself but it’s supposed to work fine.
Dec 6, 2017 7:23 AM
Apple removed ftp due to security issues. FTP is unsafe at any speed. Do you have an absolute requirement to use FTP? Could you use SFTP instead? Just turn on «remote login» and you should be able to use SFTP.
Sep 27, 2017 4:38 PM
Yes, FTP is insecure, but most people using it for larger file transfers within their network, where SFTP is not needed. Now, I need to find an SFTP/SCP server for my transfers that were perfectly fine in FTP before.. 😟
Like someone already said, it would have been nice to know, since these built-in features made the Mac that much nicer to use than PC.
Oct 10, 2017 6:24 PM
I need to find an SFTP/SCP server for my transfers that were perfectly fine in FTP before.. 😟
It is built into the operating system. Just turn on remote login. Technically, you don’t need SFTP locally, but it isn’t any slower than FTP, especially locally.
Oct 10, 2017 7:03 PM
FTP was our known, go-to solution to transfer a firmware upgrade file from a MacBook to a radio. I’ll check to see if SFTP could work.
Oct 11, 2017 2:57 AM
Fortunately, I work with lots of dinosaurs who don’t update anything unless it’s brazenly obvious. I’ll give this a shot. Thank you for your suggestion.
Oct 11, 2017 2:59 AM
Apple is well-known for breaking compatibility with older technologies. Microsoft, however, is well-known for maintaining compatibility with older versions. Yet Apple customers always keep updating to whatever Apple’s latest buggy OS might be, regardless of what won’t work anymore, and then complain about it. Windows users are notorious for running ancient versions. I wonder, do Windows users complain that Microsoft never gives them any new features in XP?
Oct 11, 2017 4:51 AM
There is the venerable rcp(1), and its replacement, rsync(1) for remote network transfer solutions.
Источник
Question: Q: Mac OS High Sierra «Server»
Hello. Let me start by saying because of APFS the OS is faster, but there are many problems.
I have a 2011 Mac mini with 8Gb ram and 1Tb hybrid drive.
At the login screen I can only get to login by disconnecting the hdmi cable to my Samsung HDTV and reconnecting.
In Mail, when there is a chain of more than one reply everything is blacked out with big black boxes. Gmail accounts. This was not an upgrade install, it was a fresh install.
OS X «server» 10.13, where is file sharing in the server app? Why has iOS and WebDAVS support been removed? You make the Files app for iOS11 where you can connect to OS X Server shares locally and via VPN, which functions perfectly when connected to OS X server 10.12.6 or 10.11.6. But now on 10.13 server it’s removed. The sense in that is.
You finally had a server that could share data to all mobile and desktop Operating Systems, OS X/iOS/Windows/Linux/Android, then you remove it! Please explain to me the logic in this?
My business and my clients need this ability. Put it back.
Mac mini, macOS High Sierra (10.13), OS X Server
Posted on Sep 27, 2017 1:15 AM
Helpful answers
The server app has become a joke, Content Caching doesn’t work,
and File Sharing is insecure!
And no one seems to care!
Oct 5, 2017 6:27 AM
Don’t know about webdavs, but pretty much any Linux
distro can install SMB services, if it is not already part.
Various GUI’s available for configuring if command line is
I am sure there are either distros with webav built-in or
Although in terms of security, probably want a commercial/enterprise distro.
Oct 5, 2017 8:38 AM
There’s more to the conversation
Loading page content
Page content loaded
So come on Apple, where is 10.13.1 and Server 5.5 or 6.0? This simply is NOT good enough. Releasing BETA software with functionality that has worked right through OS X Server 10.11 and 10.12, then just remove it. You then have the cheek to give a manual on WFSCTL lol. It does not work, ports 80 and 443 are used by the OS (just how it should be) and used for WebDAVS, WFSCTL directly tries to conflict with that. Even if you get it enabled, no client can connect to it. WebDAVS is used everyday by me and my clients, its used to share data to Linux/iOS/Android/MacOS and Windows because it DID work very well. I installed iOS 11.0.2, yes Files app still has the option for Mac OS Server and happily connects to 10.11/10.12 servers locally and via VPN. I cannot allow any clients to install 10.13 «Server» on live Mac mini servers, its too buggy, well, its a beta! Be careful Apple, you are turning into Microsoft! PUT THE SERVICE BACK!
Источник