Last active
September 26, 2024 02:52
-
-
Save bryanisimo/d9547902046c6b5d7396 to your computer and use it in GitHub Desktop.
Installing NGINX+PHP+MYSQL+DNSMASQ in OSX "El Capitan"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!bash | |
| # Removing apache from autostart | |
| sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist | |
| brew tap homebrew/services | |
| # Installing NGINX | |
| brew install nginx | |
| # Adding NGINX to autostart | |
| ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents | |
| launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist | |
| # Installing PHP | |
| brew install -v php56 --with-debug --without-apache --with-fpm --with-mysql | |
| # Setting timezone and change other PHP settings | |
| (export USERHOME=$(dscl . -read /Users/`whoami` NFSHomeDirectory | awk -F"\: " '{print $2}') ; sed -i '-default' -e 's|^;\(date\.timezone[[:space:]]*=\).*|\1 \"'$(sudo systemsetup -gettimezone|awk -F"\: " '{print $2}')'\"|; s|^\(memory_limit[[:space:]]*=\).*|\1 512M|; s|^\(post_max_size[[:space:]]*=\).*|\1 200M|; s|^\(upload_max_filesize[[:space:]]*=\).*|\1 100M|; s|^\(default_socket_timeout[[:space:]]*=\).*|\1 600|; s|^\(max_execution_time[[:space:]]*=\).*|\1 300|; s|^\(max_input_time[[:space:]]*=\).*|\1 600|; $a\'$'\n''\'$'\n''; PHP Error log\'$'\n''error_log = '$USERHOME'/Sites/logs/php-error_log'$'\n' $(brew --prefix)/etc/php/5.6/php.ini) | |
| export PATH=/usr/local/sbin:${PATH} | |
| # Installing MySQL | |
| brew install -v mysql | |
| # Enable MySQL | |
| mysql.server restart | |
| # Adding NGINX to autostart | |
| ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents | |
| launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist | |
| # Configure MySQL | |
| mysql_secure_installation | |
| # Making all .dev request respond with localhost | |
| brew install dnsmasq | |
| echo 'address=/.dev/127.0.0.1' > /usr/local/etc/dnsmasq.conf | |
| # Adding DNSMASQ to autostart | |
| sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons | |
| sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist | |
| # IMPORTANT, you need to add the follow IP to DNS Settings | |
| # 127.0.0.1 | |
| # 8.8.8.8 | |
| # 4.4.4.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment