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
SetEnv GIT_PROJECT_ROOT /data/repos
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
AuthName "Git Access"
Continue reading Make Git work on HTTP protocol
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.
Continue reading Apache – Enable Cross-origin resource sharing CORS
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
We can deny the access for a specific folder in webroot. Create the following .htaccess file in that restrictive folder.
deny from all
allow from 127.0.0.1
All access from other IPs are denied except for 127.0.0.1.
Reference: .htaccess: Deny From All – Prohibit, Forbid or Restrict Directory Access
When i am trying to setup a new server, most of the time i just used the default settings of Apache. But sometimes if the server is not equipped with enough RAM, the Apache service may consume all the server resources causing server failure. Here is an example for limited the resource comsumption by Apache.
Continue reading Ubuntu – Limit the RAM consumption by Apache
If you can’t edit the Apache configuration, you can do the redirection by setting up a virtual host as discussed in the post below.
Apache – Redirect non-www to www Subdomain
Or if you can add the following lines in the webroot .htaccess for the redirection. Continue reading .htaccess – Redirect non-www to www Subdomain
Redirecting non-www to www url can be simply done by adding a virtual host configuration. For example, if i have a domain ykyuen.com and i want to redirect it to http://www.ykyuen.com, just add the following virtual host. Continue reading Apache – Redirect non-www to www Subdomain
We can use .htaccess to redirect http://example.com to http://www.example.com by using the rewrite engine. But i find another simple way to implement the redirection just by setting up a VirtualHost.
Assume you have the current VirtualHost setting as follow. Continue reading Apache – Redirect non www to www using VirtualHost setting
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
Sometimes we may want to have more than one domain name and all point to the same website. This can be done by setting up a rewrite in the Apache VirtualHost setting.
Assume we have setup a website with domain abc.com using the following VirtualHost setting. Continue reading Apache – Redirect Domain