You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I just got a new 2022 Macbook Pro 16" and I love it.
I've prepared some stuff to get started, because that's my first time using macOS so I just have to get used to it haha.
There is a lot of stuff that can be done better, but for now this setup satisfies me.
If there is a problem with starting Apache server - make sure you've done everything correctly.
If yes, check if Apache server is running:
ps -aef | grep httpd
Try to restart it using Brew services:
brew services restart httpd
Your error logs can be found here:
tail -f /opt/homebrew/var/log/httpd/error_log
If there is a problem with permissions (as non-sudo user), try to run apache directly
/opt/homebrew/bin/httpd -k start
This bypasses the brew services command and often prints out specific issues. If you have issues reported about not being able to write to log files, try removing all the current log httpd log files:
rm -rf /opt/homebrew/var/log/httpd/*
And try to run command again. If you're getting an error similar to this:
Address already in use: AH00072: make_sock: could not bind to address
Try changing Listen option in httpd.conf (check the instruction below) to this:
Listen 0.0.0.0:80
Apache configuration
Now we have to configure our Apache server. Make sure you can open files in VS Code via terminal, then open Apache configuration file httpd.conf in the IDE
code /opt/homebrew/etc/httpd/httpd.conf
Port
Search for a line:
Listen 8080
and change port to 80:
Listen 80
Document root folder
Default document root directory is /opt/homebrew/var/www, but can change it, for example to your home directory
Search for DocumentRoot and you should see
DocumentRoot "/opt/homebrew/var/www"
You can change it now to the directory of your choice:
DocumentRoot "/Users/<your_username>/dev"
You also need to change <Directory> tag right below the DocumentRoot line. This should point to your new directory as well:
<Directory "/Users/<your_username>/dev">
htaccess files
In the <Directory> tag you have AllowOverride option, change it to All
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
Another important thing is to enable mod_rewrite. To do it, simply search for mod_rewrite.so and make sure is uncommented:
To make sure that all permissions are correct, we have to change a User and Group in config to the current username. By default both are daemon or _www. Simply just change it to:
User <your_username>
Group staff
Servername
Apache likes to have a server name in the configuration, but this is disabled by default, so search for example.com, find this line:
#ServerName www.example.com:8080
and replace it with:
ServerName localhost
After changing anything in config file, you have to restart Apache server:
brew services restart httpd
⚠ If you receive an error upon restarting Apache, try removing the quotes around the DocumentRoot and Directory designations we set up earlier.
Let's test if you did everything correctly, create an index.html in your DocumentRoot directory with some dummy data inside:
mkdir ~/dev
echo"<h1>My User Web Root</h1>">~/dev/index.html
Now go to your browser and open http://localhost url.
🛑 Make sure you removed :8080 from the URL. You might also clear browser cache using shortcut⇪⌘R .
You should see the My User Web Root text. If not, check Troubleshooting section above.
To get more details and features, feel free to check full grav tutorial here.
phpMyAdmin
Install phpmyadmin using brew:
brew install phpmyadmin
Then you'll get an instruction how to connect it to the Apache server.
Simply open httpd.conf
code /opt/homebrew/etc/httpd/httpd.conf
add following code (feel free to copy code provided by phpMyAdmin installation) at the end of httpd.conf configuration file.
Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
This file contains 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
# Aliases by Coding Garden (w3cj) - https://github.com/w3cj/dotfiles/blob/master/.bash_profile
# -------
# Aliases
# -------
alias cpv='rsync -ah --info=progress2'
alias ns='npm start'
alias start='npm start'
alias nr='npm run'
alias run='npm run'
alias nis='npm i -S'
alias nid='npm i -D'
alias l="ls" # List files in current directory
alias ll="ls -al" # List all files in current directory in long list format
alias o="open ." # Open the current directory in Finder
# ----------------------
# Git Aliases
# ----------------------
alias ga='git add'
alias gaa='git add .'
alias gpsh='git push'
alias gl='git log'
alias gs='echo ""; echo "*********************************************"; echo -e " DO NOT FORGET TO PULL BEFORE COMMITTING"; echo "*********************************************"; echo ""; git status'
alias gss='git status -s'
alias gd='git diff'
alias gdc='git diff --cached'
alias gcm='git commit -m'
alias gca='git commit -am'
alias gb='git branch'
alias gc='git checkout'
alias gra='git remote add'
alias grs='git reset'
alias grr='git remote rm'
alias gpu='git pull'
alias gcl='git clone'
alias gi='git init'
# ----------------------
# Functions
# ----------------------
function mkcd --description "Create directory and enter it"
This file contains 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
This file contains 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