Jackson
  • 請先讀我
  • 目錄
  • LYNX INDOOR2
    • LYNX INDOOR 2
    • 歡迎
    • 讓我們開始吧
    • 01. 放置攝影機
    • 02. 攝影機供電
    • 03. 下載 TEND SECURE APP
    • 04. 啟動 TEND SECURE APP
    • 攝影機 LED 燈
    • 有限的兩年製造商的保修
  • Vim
    • 序
    • 安裝
    • 普通模式指令
      • 移動
      • 搜尋
      • {motion}
      • 視窗、標籤頁、緩衝區
      • 拼寫檢查器
      • 文件管理器
    • 可視模式
    • 插入模式指令
    • Ex命令模式指令
      • 自動補齊
      • [range] {address}
      • 視窗、標籤頁
      • 緩衝區
      • 暫存器
      • ex-flags
      • Quickfix
      • tags
      • 文件管理器
    • 終端模式
    • 搜尋模式指令
      • {pattern}
      • magic
    • 環境設定
      • 環境變數
      • 映射
      • try catch
      • autocmd
      • 編輯器高亮顏色
    • 設定 help 文件中文版
    • 交換文件
    • 比較檔案
      • 解決 git 衝突
    • 函數庫
    • 插件推薦
      • 代碼
        • vim-snippets
        • coc
          • coc-snippets
          • coc-phpls
          • coc-json
          • ccls
          • VimScript Language Server
          • coc-prettier
        • deoplete
        • ale
          • C
          • HTML
          • Javascript
        • tabnine
        • php-cs-fixer
        • NERD Comment
        • ctags
      • 外觀
        • Dracula
        • NERDTree
        • airline
        • css color
        • coc-explorer
        • purity
        • startify
        • vim-mundo
      • 插件管理器
        • vim-plug
        • 原生插件管理
        • Vundle
      • Git
        • vim-fugitive
        • gv.vim
      • 分析插件
      • surround
      • Auto Pairs
      • visual-star-search
      • vim-tmux-navigator
    • 什麼是 vimrc
      • 設定檔案配置
      • ftplugin
  • 終端
    • 序
    • bash 腳本
      • 基礎
      • 環境變數
      • 正規表示式
      • 參數
      • 常用內建指令
        • 輸出
        • 捕捉中斷
        • shell 選項
      • 條件判斷
      • 迴圈
      • 函式
      • Windows 上使用 bash
      • 更新 bash
    • 指令
      • bash
        • 程序
        • 使用者與群組
        • 分析網路,檢測並與網路介面卡進行互動
        • 查看檔案與目錄
        • 建立與修改檔案或目錄
        • 搜尋
        • 壓縮與打包
        • 備份
        • 重導向
        • 寄信
        • 操作終端機
        • 另外安裝的指令
          • jq JSON 剖析器
          • wget
      • zsh
        • alias
      • Linux
        • 排程
      • 目錄路徑
      • 萬用字元
    • tmux
      • 未進 tmux 的終端指令
      • 進入到 tmux 指令
      • 進入到 tmux 的快捷鍵
      • 命令提示指令
      • 配置 tmux
      • 插件推薦
        • 插件管理器
        • vim-tmux-navigator
    • 插件推薦
      • 外觀
        • Gogh
        • purity
        • Dracula
        • powerline
      • zsh
        • zsh-syntax-highlighting
        • zsh-autosuggestions
  • Git
    • 序
    • 常用指令
    • 切換帳號
  • 作業系統
    • kali
      • 快捷鍵
      • E: unable to locate package
      • 中文亂碼和中文輸入
      • 命令提示字元修改成 Windows 格式
    • mac os
      • 架站 MAMP
        • Apache
        • PHP
        • MySQL
        • phpMyAdmin
        • localhost https
    • Ubuntu
      • 安裝 PHP
      • 安裝 Nginx
  • AWS
    • 序
    • Amazon EC2
  • WordPress
    • localhost ftp 連線問題
    • 強制修改信箱帳號
    • bitnami 登入 Wordpress
  • 影片剪輯
    • 序
    • 自動生成字幕
  • 其它
    • 鍵盤符號中英文
Powered by GitBook
On this page
  • 說明
  • 安裝
  • 停用 mac 原生的 Apache
  • 安裝 Apache
  • Apache 設定
  • 設定 Virtual Host
  • Apache 指令
  • 參考

Was this helpful?

  1. 作業系統
  2. mac os
  3. 架站 MAMP

Apache

說明

Apache 伺服器,mac os 原本就有安裝 不過版本可能不是最新的

安裝

以下為安裝步驟

  1. 停用 mac 原生的 Apache

  2. 安裝 Apache

停用 mac 原生的 Apache

暫停原本 mac 的 apache $ sudo apachectl stop

關閉自動開啟 $ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

安裝 Apache

使用 brew 安裝

更新 brew $ brew update

安裝 httpd $ brew install httpd

啟動 Apache 服務 $ sudo brew services start httpd

重新啟動 Apache 服務 $ brew services restart httpd

重啟 apache $ sudo apachectl -k restart

Apache 設定

編輯 /usr/local/etc/httpd/httpd.conf 檔案

將 Listen 8080 改成 Listen 80

將 DocumentRoot "/usr/local/var/www" 改成家目錄底下的 www 資料夾 DocumentRoot "/Users/yourName/www"

將 <Directory "/usr/local/var/www"> 改成家目錄底下的 www 資料夾 <Directory "/Users/yourName/www">

移除註解 LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so

移除註解並改成 ServerName localhost

移除註解 Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

重啟 apache $ sudo apachectl -k restart

設定 Virtual Host

原本應該有兩個範例,可以把它們註解,保留以下這個

/usr/local/etc/httpd/extra/httpd-vhosts.conf
<VirtualHost *:80>
  ServerAdmin yourMail@mail.com
  DocumentRoot "/Users/yourName/www"

  <Directory "/Users/yourName/www">
      Options FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      Allow from all
  </Directory>
</VirtualHost>

Apache 指令

sudo apachectl start 開啟 apache

sudo apachectl stop 關閉 apache

sudo apachectl -k restart 重啟 apache

參考

裡面還有其他 apache 相關設定的教學 作者這篇內容皆參考此篇文章而寫的

Previous架站 MAMPNextPHP

Last updated 3 years ago

Was this helpful?

macOS 上安裝 Apache - OA Wu's BlogOA Wu's Blog