Skip to content
jack edited this page Dec 23, 2016 · 7 revisions

The goal of this page:

  1. Setup a VirtualHost for local development environment.
  2. Put the source code at anywhere you like instead of default DocumentRoot.
  3. Access the local version by short url http://capubbs/.
  1. Append 127.0.0.1 capubbs to /etc/hosts.
  2. Create a VirtualHost config file naming capubbs.conf.
  • The file should be located at:
    • For Mac: /etc/apache2/other/capubbs.conf.
    • For RHEL: /etc/httpd/conf.d/capubbs.conf.
    • For Debian: /etc/apache2/sites-available/capubbs.conf and execute sudo a2ensite capubbs.
  • Replace [path/to/your/code] by the path to your code. Be careful not to put the code in your private directory so that there will not be issues on permissions. The recommended directory is your home directory ~.
    • e.g. for me is /Users/huxuan/Code/CAPUBBS.
<VirtualHost *:80>
  DocumentRoot [path/to/your/code]
  ServerName capubbs
  <Directory [path/to/your/code]>
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

If your apache version is 2.4 (for most Macs with OS X Yosemite), please use the following code. Run apachectl -v to check your apache version in the terminal.

<VirtualHost *:80>
  ServerName capubbs
  DocumentRoot [path/to/your/code]
  <Directory [path/to/your/code]>
    Require all granted
  </Directory>
</VirtualHost>
  1. Restart apache.
  • For both Mac and CentOS: sudo apachectl restart.
  1. DONE! Just open any web browser and try http://capubbs/!
  2. Change bbs/lib/mainfunc.php line 5 from $url="http://127.0.0.1/api/jiekouapi.php?ip=$ip&token=$token"; to $url="http://capubbs/api/jiekouapi.php?ip=$ip&token=$token";
Clone this wiki locally