Category Archives: Apache

Make Git work on HTTP protocol

Assume SELinux is disabled on your Git server…

The following setup is on CentOS and assume your Git repositories are all located under /data/repos.

1. Install Git and Apache.

yum install git httpd

 

2. Create the /etc/httpd/conf.d/git.conf.

# Git over HTTP
<VirtualHost *:80>
  SetEnv GIT_PROJECT_ROOT /data/repos
  SetEnv GIT_HTTP_EXPORT_ALL
  ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/

  <Location /git/>
    AuthType Basic
    AuthName "Git Access"
    AuthUserFile /var/www/passwd.git
    Require valid-user
  </Location>
</VirtualHost>

Continue reading Make Git work on HTTP protocol

Advertisements

Apache – Enable Cross-origin resource sharing CORS

Long time ago, we talked about using JSONP to tackle to cross domain ajax issue.
jQuery & JSON – Make Cross Domain Request Using jQuery.getJSON() with JSONP

But this requires server side coding. If you are allow to edit the Apache config, you can simply Enable the CORS (Cross-origin resource sharing) in the VirtualHost file as follow.

1. Enable the mod_headers in Apache by entering the following command in shell.

a2enmod headers

Continue reading Apache – Enable Cross-origin resource sharing CORS

.htaccess – Redirect all URLs to a specific sub domain

Sometimes you may have multiple domains which you want to use for your website or web application. Probably you needed to park the domains on your hosting cpanel. In this case, you website or web application could be access by more than one domain which is not good for SEO and other 3rd party services may not work.

A simple way to redirect all URLs to a specific URLs is by .htaccess.

Suppose you have the following sub domains and all of them serve your website or web application.

Continue reading .htaccess – Redirect all URLs to a specific sub domain

.htaccess – Invalid command ‘AuthUserFile’, perhaps misspelled or defined by a module not included in the server configuration

I have a previous post which demonstrates how to add HTTP Authentication by .htaccess.
.htaccess – Setting Password For Your Web Folder

But if it does not work and shown the following error in the Apache error log

  • /home/ykyuen/public_html/.htaccess: Invalid command ‘AuthUserFile’, perhaps misspelled or defined by a module not included in the server configuration

Continue reading .htaccess – Invalid command ‘AuthUserFile’, perhaps misspelled or defined by a module not included in the server configuration