<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Knowledge &#187; Linux</title>
	<atom:link href="http://wan.6te.net/?cat=3&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://wan.6te.net</link>
	<description></description>
	<lastBuildDate>Mon, 20 Jul 2015 04:51:35 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9</generator>
	<item>
		<title>Setup Subversion to use HTTP Protocol on Ubuntu Server 11.04 with post-commit Hook</title>
		<link>http://wan.6te.net/?p=157</link>
		<comments>http://wan.6te.net/?p=157#comments</comments>
		<pubDate>Fri, 06 Jun 2014 10:21:38 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=157</guid>
		<description><![CDATA[Setup Subversion to use HTTP Protocol on Ubuntu Server 11.04 with post-commit Hook By Shay Anderson on March 2012 In this example I am setting up subversion to be accessed via HTTP protocol, as in 'http://[server]/svn/example_project', and I commit to the subversion repository I am having the post-commit hook update a local website project. This [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><code>Setup Subversion to use HTTP Protocol on Ubuntu Server 11.04 with post-commit Hook<br />
By Shay Anderson on March 2012<br />
In this example I am setting up subversion to be accessed via HTTP protocol, as in 'http://[server]/svn/example_project', and I commit to the subversion repository I am having the post-commit hook update a local website project. This example assumes you already have subversion installed on your server.</p>
<p>First, Install 'libapache2-svn': >> apt-get install libapache2-svn<br />
Restart Apache: >> service apache2 restart<br />
Edit file '/etc/apache2/mods-available/dav_svn.conf' and add: <Location /svn><br />
      DAV svn<br />
      SVNParentPath /home/svn<br />
      SVNListParentPath On<br />
      AuthType Basic<br />
      AuthName "My Subversion Server"<br />
      AuthUserFile /etc/subversion/passwd<br />
      <LimitExcept GET PROPFIND OPTIONS REPORT><br />
            Require valid-user<br />
      </LimitExcept><br />
</Location><br />
This will allow anonymous read-only checkouts, and authorized users are allowed to read/edit (write permissions)<br />
To disallow anonymous checkouts, replace this:<LimitExcept GET PROPFIND OPTIONS REPORT><br />
      Require valid-user<br />
</LimitExcept>With this:Require valid-user<br />
Restart Apache: >> service apache2 restart<br />
Create password file: >> htpasswd -c /etc/subversion/passwd [new user name]Then add any additional user to file with: >> htpasswd /etc/subversion/passwd [additional user name]You can check if user exists in '/etc/subversion/passwd' file with: >> cat /etc/subversion/passwd<br />
Now you can checkout you project with: >> svn checkout http://[your server location/svn/example_project /var/www/example_projectTest making changes and commit the changes: >> cd /var/www/example_project<br />
>> svn commit -m 'test commit'<br />
If you attempt to commit and receive an error like:Commit<br />
Commit failed (details follow):<br />
Can't open file '/home/svn/example_project/db/txn-current-lock': Permission deniedYou need to change the permissions for the subversion repository: >> chown -R www-data:www-data /home/svn/example_projectOr you can change the permissions for all subversion repositories with: >> chown -R www-data:www-data /home/svn<br />
If you are using a hook, for example a hooks/post-commit like:#!/bin/sh<br />
/usr/bin/svn update /var/www/example_project<br />
You will want to set correct permissions for '/var/www/example_project': >> chown -R www-data:www-data /var/www/example_project-- OR --<br />
If you are using a hook, for example a hooks/post-commit like:#!/bin/sh<br />
sudo -u [your user] /usr/bin/svn update /var/www/example_project<br />
You will need to add this to the end of the '/etc/sudoers' file:www-data ALL=(ALL) NOPASSWD: /usr/bin/svn<br />
NOTE: if you are not allowing anonymous read-only checkouts (explained above), then you would need to add this to your post-commit:/usr/bin/svn update /var/www/example_project --username [your subversion user name] --password [your subversion password]-- OR -- sudo -u [your user] /usr/bin/svn update /var/www/example_project --username [your subversion user name] --password [your subversion password]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=157</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN Add all Directories and Files Recursively Using Add Command</title>
		<link>http://wan.6te.net/?p=155</link>
		<comments>http://wan.6te.net/?p=155#comments</comments>
		<pubDate>Fri, 06 Jun 2014 10:16:15 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=155</guid>
		<description><![CDATA[SVN Add all Directories and Files Recursively Using Add Command By Shay Anderson on November 2012 You can simply add all files and directories recursively using the Add command like: >> svn add * &#8211;forceThis will add all directories and files]]></description>
				<content:encoded><![CDATA[<p>SVN Add all Directories and Files Recursively Using Add Command<br />
By Shay Anderson on November 2012<br />
You can simply add all files and directories recursively using the Add command like: >> svn add * &#8211;forceThis will add all directories and files</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=155</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup New CentOS 6.2 Web Server</title>
		<link>http://wan.6te.net/?p=153</link>
		<comments>http://wan.6te.net/?p=153#comments</comments>
		<pubDate>Fri, 06 Jun 2014 10:03:01 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=153</guid>
		<description><![CDATA[Setup New CentOS 6.2 Web Server By Shay Anderson on November 2012 In the following article I explain how to setup a basic Web server on a new install of CentOS 6 (in my case CentOS 6.2). Install Nano First, I use the text editor nano, so I needed to install this editor first: >> [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Setup New CentOS 6.2 Web Server<br />
By Shay Anderson on November 2012<br />
In the following article I explain how to setup a basic Web server on a new install of CentOS 6 (in my case CentOS 6.2).</p>
<p>Install Nano<br />
First, I use the text editor nano, so I needed to install this editor first: >> yum install nano<br />
Setup Apache Configuration File<br />
Next, I want to disable Indexes for directory options, this means that someone can&#8217;t view the &#8216;Index Of&#8217; or listing of files in my Web directories. To do this edit the &#8216;/etc/httpd/conf/httpd.conf&#8217; and add &#8216;-Indexes&#8217; to this line: <Directory /><br />
[...]<br />
      Options FollowSymLinks -Indexes<br />
[...]<br />
</Directory>Also, add &#8216;-Indexes&#8217; to this line: <Directory "/var/www/html"><br />
[...]<br />
      Options FollowSymLinks -Indexes<br />
[...]<br />
</Directory>Next, in the same file add &#8216;index.php&#8217; as a default directory index file: DirectoryIndex index.php index.htmlSave the file and restart the Web server: >> service httpd restart<br />
Setup Root Password<br />
I like to use simple passwords for the root user, if you want to use simple passwords you must edit the &#8216;/etc/pam.d/system-auth&#8217; file, change these 2 lines: password requisite pam_cracklib.so try_first_pass retry=3 type=<br />
password sufficient pam_unix.so try_first_pass use_authtok nullok sha512 shadowTo this (comment out the first line and remove &#8216;use_authtok&#8217; from the second line): #password requisite pam_cracklib.so try_first_pass retry=3 type=<br />
password sufficient pam_unix.so try_first_pass nullok sha512 shadowSave the file and now change the root password: >> passwd root<br />
Enter new UNIX password:<br />
Setup Timezone<br />
I am setting up my server on the east coast, so I need to change my server timezone to east coast (or the New York timezone). To check your server date/time and timezone use this command: >> date<br />
Fri Nov 5 22:02:30 CST 2012Now, to change the timezone first create a backup of &#8216;/etc/localtime&#8217;: >> cp -v /etc/localtime /etc/localtime.BAKNext, remove the &#8216;/etc/localtime&#8217; file: >> rm -fv /etc/localtime Finally, create a link to the correct timezone (in my case New York): >> ln -s /usr/share/zoneinfo/America/New_York /etc/localtimeYou can check all available timezones in the &#8216;/usr/share/zoneinfo/America&#8217; directory.</p>
<p>Install FTP Server (vsftpd)<br />
Next, install a FTP server (in this example I install vsftpd): >> yum install vsftpdAdd a user for FTP access (-d switch sets the default directory for user, in this case I am setting it to the &#8216;/var/www/html&#8217; directory for Web server purposes): >> useradd -d /var/www/html ftpuserAdd a password for the user: >> passwd ftpuserNow, edit the &#8216;/etc/passwd&#8217; file so we can block the &#8216;ftpuser&#8217; user from SSH access, make sure the &#8216;ftpuser&#8217; line looks something like: ftpuser:x:500:500::/home/ftpuser:/sbin/nologinNext, edit the vsftpd configuration file &#8216;/etc/vsftpd/vsftpd.conf&#8217; file and turn anonymous OFF: # Allow anonymous FTP? (Beware &#8211; allowed by default if you comment this out).<br />
anonymous_enable=NOIn the same file make sure these settings look like: chroot_local_user=YES<br />
chroot_list_enable=YES<br />
# (default follows)<br />
chroot_list_file=/etc/vsftpd/chroot_list<br />
Then create &#8216;chroot_list&#8217; file: >> touch /etc/vsftpd/chroot_listSave the file and restart vsftpd: >> service vsftpd restartNow, you should be able to access your server via FTP using the &#8216;ftpuser&#8217; account.</p>
<p>Finally, setup vsftpd to auto startup with the server is booted: >> chkconfig vsftpd onYou can check if vsftpd is set on with: >> chkconfig &#8211;list<br />
Install PHP 5.3<br />
Next, install PHP 5.3: >> yum install php.x86_64Check the install with: >> php -v<br />
PHP 5.3.3 (cli) (built: Jul 3 2012 16:53:21)<br />
Copyright (c) 1997-2010 The PHP Group<br />
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend TechnologiesRestart Apache: >> service httpd restart</p>
<p>http://www.shayanderson.com/linux/setup-new-centos-62-web-server.htm</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=153</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Setup Ubuntu 12.10 Server with LAMP and SSH Access</title>
		<link>http://wan.6te.net/?p=151</link>
		<comments>http://wan.6te.net/?p=151#comments</comments>
		<pubDate>Fri, 06 Jun 2014 09:42:05 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=151</guid>
		<description><![CDATA[How to Setup Ubuntu 12.10 Server with LAMP and SSH Access By Shay Anderson on December 2012 In this article I include all the necessary steps for getting a Web (Apache) Server up and running on Ubuntu 12.10 with SSH access and Samba file server. Installation Install Ubuntu Server 12.10, during the install select to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>How to Setup Ubuntu 12.10 Server with LAMP and SSH Access<br />
By Shay Anderson on December 2012<br />
In this article I include all the necessary steps for getting a Web (Apache) Server up and running on Ubuntu 12.10 with SSH access and Samba file server.</p>
<p>Installation<br />
Install Ubuntu Server 12.10, during the install select to install OpenSSH, LAMP and Samba.</p>
<p>Add Root User<br />
After installation I want to enable the root user by adding a password at command line: >> sudo passwd rootAfter the password is setup for root I can switch to the root user: >> su root<br />
Setup Aliases<br />
Next, I want to setup aliases that I use, so for that I edit the &#8216;/home/[user]/.bashrc&#8217; file and add these lines by the other aliases: [...]<br />
alias z=&#8217;ls -l&#8217;<br />
alias zz=&#8217;ls -la&#8217;<br />
alias a2r=&#8217;service apache2 restart&#8217;<br />
alias rm=&#8217;rm -i&#8217;<br />
alias cp=&#8217;cp -i&#8217;<br />
alias mv=&#8217;mv -i&#8217;<br />
[...]The same steps can be used to setup the root user alias by editing the file &#8216;/root/.bashrc&#8217; (must have root priviledges).</p>
<p>Setup Static IP<br />
The next thing I want to do is setup a static IP address so I can access the server via SSH. So I edit the &#8216;/etc/network/interfaces&#8217; file so it looks something like: auto eth0<br />
iface eth0 inet static<br />
address 192.168.1.110<br />
netmask 255.255.255.0<br />
network 192.168.1.0<br />
broadcast 192.168.1.255<br />
gateway 192.168.1.1<br />
# dns-* options are implemented by the resolvconf package, if installed<br />
dns-nameservers 192.168.1.1Save the file and restart networking with: >> service networking restartYou should be able to see your IP address with the command: >> ifconfigThis should display your new static IP address.</p>
<p>Now you should be able to connect to the server via the new static IP address and SSH.</p>
<p>Setup File Server<br />
The next thing I want to do is enable file sharing on the new server. To do this I simply need to edit the Samba configuration file &#8216;/etc/samba/smb.conf&#8217;, first set the workgroup: workgroup = [your workgroup name]Then at the bottom of the file add your share directories, for example: [webserver]<br />
      comment = Linux Web Server<br />
      path = /var/www<br />
      browsable = yes<br />
      guest ok = yes<br />
      read only = no<br />
      create mask = 0755<br />
      force user = [user for share]</p>
<p>[svn]<br />
      comment = Subversion Repos<br />
      path = /home/svn<br />
      browsable = yes<br />
      guest ok = yes<br />
      read only = no<br />
      create mask 0755<br />
      force user = [user for share]Then restart the Samba service: >> service smbd restartYou should now be able to access your shared directories.</p>
<p>Downgrading PHP 5.4 to PHP 5.3<br />
When I installed Ubuntu 12.10 I noticed that the it installed a version of PHP I didn&#8217;t want to use: >> php -v<br />
PHP 5.4.6-1ubuntu1I want to use PHP 5.3, so first I need to check the packages that were included in the PHP 5.4 install: >> dpkg &#8211;list | grep php<br />
ii libapache2-mod-php5 5.4.6-1ubuntu1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)<br />
ii php5-cli 5.4.6-1ubuntu1 amd64 command-line interpreter for the php5 scripting language<br />
ii php5-common 5.4.6-1ubuntu1 amd64 Common files for packages built from the php5 source<br />
ii php5-mysql 5.4.6-1ubuntu1 amd64 MySQL module for php5So I want to remove the PHP 5.4 packages: >> apt-get remove libapache2-mod-php5 php5-cli php5-common php5-mysqlThen run update: >> apt-get updateNext, create the file &#8216;/etc/apt/sources.list.d/precise.list&#8217; and add these lines: # required for PHP 5.3<br />
deb http://bg.archive.ubuntu.com/ubuntu/ precise main restricted<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise main restricted</p>
<p>deb http://bg.archive.ubuntu.com/ubuntu/ precise-updates main restricted<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-updates main restricted</p>
<p>deb http://bg.archive.ubuntu.com/ubuntu/ precise universe<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise universe<br />
deb http://bg.archive.ubuntu.com/ubuntu/ precise-updates universe<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-updates universe</p>
<p>deb http://bg.archive.ubuntu.com/ubuntu/ precise multiverse<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise multiverse<br />
deb http://bg.archive.ubuntu.com/ubuntu/ precise-updates multiverse<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-updates multiverse<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ natty-backports main restricted universe multiverse</p>
<p>deb http://security.ubuntu.com/ubuntu precise-security main restricted<br />
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted<br />
deb http://security.ubuntu.com/ubuntu precise-security universe<br />
deb-src http://security.ubuntu.com/ubuntu precise-security universe<br />
deb http://security.ubuntu.com/ubuntu precise-security multiverse<br />
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse</p>
<p>deb-src http://archive.canonical.com/ubuntu natty partner</p>
<p>deb http://extras.ubuntu.com/ubuntu precise main<br />
deb-src http://extras.ubuntu.com/ubuntu precise main</p>
<p>deb http://bg.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse<br />
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse</p>
<p>deb http://archive.canonical.com/ubuntu precise partner<br />
deb-src http://archive.canonical.com/ubuntu precise partnerSave the file and re-run update: >> apt-get updateNow you can re-install PHP (5.3) using the precise list: >> apt-get -t precise install libapache2-mod-php5 php5-cli php5-common php5-mysqlVerify PHP version: >> php -v<br />
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli)PHP has been successfully downgraded to PHP 5.3. I also use the PHP GD Library and cURL PHP Library, so I also installed those: >> apt-get -t precise install php5-curl php5-gdThat will install both libraries.</p>
<p>Configure Apache Web Server<br />
Next, edit the &#8216;/etc/apache2/apache2.conf&#8217; file and at the bottom of the file add these lines: [...]<br />
ServerName localhost</p>
<p># turn off directory indexing<br />
<Directory "/var/www"><br />
      Options -Indexes<br />
</Directory></p>
<p>Include /var/www/www.httpd.confThen create the file &#8216;/var/www/www.httpd.conf&#8217; file and you can now add virtual hosts like: <VirtualHost *:80><br />
      ServerName 0.0.0.0 # replace 0.0.0.0 with your server IP address<br />
      DocumentRoot /var/www<br />
      CustomLog ${APACHE_LOG_DIR}/access.log combined<br />
</VirtualHost></p>
<p><VirtualHost *:80><br />
      ServerName myexample.com<br />
      ServerAlias www.myexample.com<br />
      DocumentRoot /var/www/myexample.com<br />
      ErrorLog /var/log/www.myexample.log<br />
      CustomLog ${APACHE_LOG_DIR}/access.log combined<br />
</VirtualHost>Then enable Apache mods: >> a2enmod rewrite<br />
>> a2enmod headersBecause I am using this server as a development server I want to display all PHP errors, warnings and notices &#8211; to do this I edit the &#8216;/etc/php5/apache2/php.ini&#8217; file, and set these values: [...]<br />
error_reporting = E_ALL | E_STRICT<br />
[...]<br />
display_errors = On<br />
[...]<br />
display_startup_errors = On<br />
[...]<br />
error_prepend_string = &#8220;
<div style='color:#f00'>&#8221;<br />
[...]<br />
error_append_string = &#8220;</div>
<p>&#8221;<br />
[...]Restart Apache:>> service apache2 restart<br />
Setup MySQL Server<br />
Next, I setup the MySQL server so that I can connect locally using the root user. First, edit the &#8216;/etc/mysql/my.cnf&#8217; and comment out the bind-address so it looks like: [...]<br />
;bind-address = 127.0.0.1<br />
[...]Then we need to allow access for root, log into the MySQL server: >> mysql -h localhost -u root -pThen using MySQL command line run these commands: mysql> use mysql;<br />
mysql> INSERT INTO user (Host,User,Password) VALUES(&#8216;%&#8217;,&#8217;root&#8217;,PASSWORD(&#8216;your-root-password&#8217;));<br />
mysql> FLUSH PRIVILEGES;<br />
mysql> GRANT ALL PRIVILEGES ON *.* TO &#8216;root&#8217;@&#8217;%&#8217; WITH GRANT OPTION;<br />
mysql> FLUSH PRIVILEGES;<br />
mysql> quitNow restart MySQL: >> service mysql restartNow MySQL should be ready to use.</p>
<p>Install Subversion<br />
I use subversion, so to install I use: >> apt-get install subversionYou can find how to Setup Subversion Server on Ubuntu 12.10 here.</p>
<p>Install Misc Packages<br />
I also use the &#8216;tree -A&#8217; command, so I install the tree package: >> apt-get install treeAlso, I install zip: >> apt-get install zip</p>
<p>http://www.shayanderson.com/linux/how-to-setup-ubuntu-1210-server-with-lamp-and-ssh-access.htm</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=151</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install and Setup Subversion Server on Ubuntu 12.10 Server with Multiple Repositories</title>
		<link>http://wan.6te.net/?p=148</link>
		<comments>http://wan.6te.net/?p=148#comments</comments>
		<pubDate>Fri, 06 Jun 2014 09:37:38 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=148</guid>
		<description><![CDATA[Install and Setup Subversion Server on Ubuntu 12.10 Server with Multiple Repositories By Shay Anderson on January 2013 In this article I explain how to install and setup subversion on a Ubuntu server (in this example Ubuntu 12.10 server). Install Subversion First, install subversion: >> apt-get install subversionOr, you can check what version of subversion [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Install and Setup Subversion Server on Ubuntu 12.10 Server with Multiple Repositories<br />
By Shay Anderson on January 2013<br />
In this article I explain how to install and setup subversion on a Ubuntu server (in this example Ubuntu 12.10 server).</p>
<p>Install Subversion<br />
First, install subversion: >> apt-get install subversionOr, you can check what version of subversion is already installed: >> svn &#8211;version<br />
svn, version 1.7.5 (r1336830)<br />
compiled Sep 28 2012, 11:22:04<br />
[...]<br />
Setup Subversion Repositories<br />
Next, I want to setup a location for the subversion repositories: >> mkdir /home/reposNow this is where I can create subversion repositories. I am going to create two example repositories to use for this example: >> svnadmin create /home/repos/project1>> svnadmin create /home/repos/project2Next, I want to setup the correct permissions for the repositories: >> chmod -R g+rws /home/reposNow I can setup a group that will use the subversion repositories: >> sudo groupadd svnNext I can change the group ownership of the repository directories: >> chgrp -R svn /home/reposI need to add my user to the &#8216;svn&#8217; group, to do this I do (replace [username] with the correct user): >> usermod -a -G svn [username]Then I can check if my user has been added to the group: >> groups<br />
adm cdrom sudo dip plugdev sambashare lpadmin svn<br />
Test New Repositories<br />
The next step is to test the new repositories that have be setup: >> mkdir /home/tmp<br />
>> svn checkout file:///home/repos/project1 /home/tmp<br />
Checked out revision 0.Now I create a test file that can be used to commit to the new repository: >> echo &#8216;this is test&#8217; > /home/tmp/test.txtAdd the file: >> svn add /home/tmp/test.txt<br />
A tmp/test.txtTest commit the file: >> svn commit -m &#8220;initial test commit&#8221; /home/tmp<br />
Adding tmp/test.txt<br />
Transmitting file data .<br />
Committed revision 1.Success!</p>
<p>Remote Access Subversion Repositories Using SVN Protocol<br />
This section is the most important section where we setup remote accessing to our new subversion repositories using the svn protocol. We can to allow access to all repositories, so instead of configuring each separate repository for access, we can setup a central configuration so all repositories can be accessed. First, let&#8217;s setup a user/password file for access our repositories, create a new file &#8216;passwd-users&#8217; using your text editor: >> nano /home/repos/passwd-usersAnd a users and passwords: [users]<br />
shay = mypass<br />
user2 = secret<br />
mike = goodpasswordSave file and exit. Add correct permissions to protect users/passwords file: >> sudo chmod 600 /home/repos/passwd-users<br />
Now we need to edit the &#8216;conf/svnserve.conf&#8217; files for each repository: >> nano /home/repos/project1/conf/svnserve.confNow replace all the content in the file with: [general]<br />
anon-access = none<br />
auth-access = write<br />
password-db = /home/repos/passwd-users<br />
realm = Development TeamThis needs to be done for all repositories that you want to allow remote access for.</p>
<p>Now I can start the subversion server &#8216;svnserve&#8217;: >> sudo svnserve -d -r /home/reposThis will allow access to our repositories located in &#8216;/home/repos&#8217;.</p>
<p>Test the svn protocol checkout: >> mkdir /home/tmp2<br />
>> svn checkout svn://[server IP address]/project1 &#8211;username [username]This should checkout the &#8216;project1&#8242; repository files.</p>
<p>Note: While the above &#8216;svnserve.conf&#8217; setup will work, it might be easier for you to use a global/common &#8216;svnserve.conf&#8217; file. You can accomplish a global/comman &#8216;svnserve.conf&#8217; file by using symlinks. First, create a copy of the &#8216;svnserve.conf&#8217; file you created for the &#8216;project1&#8242; repository in &#8216;/home/repos&#8217;: >> cp -v /home/repos/project1/conf/svnserve.conf /home/reposThen move both &#8216;svnserve.conf&#8217; files for repositories &#8216;project1&#8242; and &#8216;project2&#8242; to backup files: >> mv -v /home/repos/project1/conf/svnserve.conf /home/repos/project1/conf/svnserve.conf.BAK>> mv -v /home/repos/project2/conf/svnserve.conf /home/repos/project2/conf/svnserve.conf.BAKThen create symlinks to global/common &#8216;svnserve.conf&#8217; file for both repositories: >> ln -s /home/repos/svnserve.conf /home/repos/project1/conf/svnserve.conf>> ln -s /home/repos/svnserve.conf /home/repos/project2/conf/svnserve.confFinally, restart the subversion server: >> sudo killall svnserve<br />
>> sudo svnserve -d -r /home/reposNow you have an easy-to-use &#8216;svnserve.conf&#8217; file.</p>
<p>Setup Script for Subversion Server Auto-Startup<br />
Another important part of setting up a subversion server is forcing the subversion server service to auto start when the server boots, as well as giving us a convenient way to start/stop/restart the subversion server service. To do this create the file: >> nano /etc/init.d/svnserveThen add a simple script like: #! /bin/sh<br />
#<br />
# svnserve {start|stop|restart|force-reload} script<br />
#<br />
# @author Shay Anderson 01.13<br />
#</p>
<p># set repositories path<br />
REPOS=/home/repos</p>
<p># set svnserve daemon<br />
DAEMON=/usr/bin/svnserve</p>
<p># configuration settings<br />
PATH=/sbin:/bin:/usr/sbin:/usr/bin<br />
SVN=svnserve<br />
SVN_DESC=&#8221;Subversion Server Daemon ($SVN)&#8221;</p>
<p>case &#8220;$1&#8243; in<br />
      start)<br />
            echo &#8220;Starting $SVN_DESC&#8230;&#8221;<br />
            start-stop-daemon &#8211;start &#8211;quiet &#8211;oknodo &#8211;exec $DAEMON &#8212; -d -r $REPOS >/dev/null 2>&#038;1<br />
            echo<br />
            ;;<br />
      stop)<br />
            echo &#8220;Stopping $SVN_DESC&#8230;&#8221;<br />
            start-stop-daemon &#8211;stop &#8211;quiet &#8211;oknodo &#8211;exec $DAEMON<br />
            echo<br />
            ;;<br />
      restart|force-reload)<br />
            $0 stop<br />
            sleep 1<br />
            $0 start<br />
            ;;<br />
      *)<br />
            echo &#8220;Usage: $0 {start|stop|restart|force-reload}&#8221;<br />
            echo<br />
            exit 1<br />
            ;;<br />
esac</p>
<p>exit 0Make the script executable: >> chmod +x /etc/init.d/svnserveRegister the script with the Ubuntu OS: >> update-rc.d svnserve defaults<br />
update-rc.d: warning: /etc/init.d/svnserve missing LSB information<br />
update-rc.d: see<br />
Adding system startup for /etc/init.d/svnserve &#8230;<br />
/etc/rc0.d/K20svnserve -> ../init.d/svnserve<br />
/etc/rc1.d/K20svnserve -> ../init.d/svnserve<br />
/etc/rc6.d/K20svnserve -> ../init.d/svnserve<br />
/etc/rc2.d/S20svnserve -> ../init.d/svnserve<br />
/etc/rc3.d/S20svnserve -> ../init.d/svnserve<br />
/etc/rc4.d/S20svnserve -> ../init.d/svnserve<br />
/etc/rc5.d/S20svnserve -> ../init.d/svnserveNow the subversion server daemon should start when the server boots.</p>
<p>Update Project Directory When Project is Committed to Subversion Repository<br />
Often times it is help to update a project directory after a commit has been done to the project repository. For example, say we makes changes to a file in our &#8216;project1&#8242; repository and after we commit the changes we want the Website directory for the project to up auto updated. For this example, create a Website directory for the &#8216;project1&#8242; project: >> mkdir /var/www/project1Now checkout the &#8216;project1&#8242; repository: >> svn checkout svn://[server IP address]/project1 &#8211;username [user] /var/www/project1Now we need to setup a post-commit script that will update this project Website directory when someone commits to the &#8216;project1&#8242; repository. Copy the post-commit hook template to a post-commit script file: >> cp -v /home/repos/project1/hooks/post-commit.tmpl /home/repos/project1/hooks/post-commitMake the new file executable: >> chmod +x /home/repos/project1/hooks/post-commitEdit the post-commit script: >> nano /home/repos/project1/hooks/post-commitAnd add a couple lines that will update the Website directory: #!/bin/sh<br />
sudo -u [shell username] /usr/bin/svn update /var/www/project1 &#8211;username [svn repo username] &#8211;password [svn repo user password]Save and close the file. Now when a commit is executed on the &#8216;project1&#8242; repository, the post-commit script will auto update the &#8216;/var/www/project1&#8242; directory. If any errors occur when committing make sure that all permissions and credentials are correct.</p>
<p>http://www.shayanderson.com/linux/install-and-setup-subversion-server-on-ubuntu-1210-server-with-multiple-repositories.htm</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=148</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set and Change the Default Editor in Linux</title>
		<link>http://wan.6te.net/?p=145</link>
		<comments>http://wan.6te.net/?p=145#comments</comments>
		<pubDate>Fri, 06 Jun 2014 09:34:24 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=145</guid>
		<description><![CDATA[Set and Change the Default Editor in Linux By Shay Anderson on January 2013 Changing and setting the default editor in Linux is easy, here is an example using the command line: >> export EDITOR=nanoOr if you wanted to use for one time, like when using crontab: >> EDITOR=nano crontab -e http://www.shayanderson.com/linux/set-and-change-the-default-editor-in-linux.htm]]></description>
				<content:encoded><![CDATA[<p>Set and Change the Default Editor in Linux<br />
By Shay Anderson on January 2013<br />
Changing and setting the default editor in Linux is easy, here is an example using the command line: >> export EDITOR=nanoOr if you wanted to use for one time, like when using crontab: >> EDITOR=nano crontab -e</p>
<p>http://www.shayanderson.com/linux/set-and-change-the-default-editor-in-linux.htm</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=145</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: Install and Configure Subversion 1.7 on CentOS 5</title>
		<link>http://wan.6te.net/?p=143</link>
		<comments>http://wan.6te.net/?p=143#comments</comments>
		<pubDate>Fri, 06 Jun 2014 09:33:35 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=143</guid>
		<description><![CDATA[Tutorial: Install and Configure Subversion 1.7 on CentOS 5 By Shay Anderson on May 2013 In this simple tutorial I am going to walk you through installing Subversion 1.7 (or Subversion 1.6 if you don&#8217;t need Subversion 1.7) on CentOS 5 (in this tutorial I am installing Subversion on Cent OS 5.9). Subversion Installation First, [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Tutorial: Install and Configure Subversion 1.7 on CentOS 5<br />
By Shay Anderson on May 2013<br />
In this simple tutorial I am going to walk you through installing Subversion 1.7 (or Subversion 1.6 if you don&#8217;t need Subversion 1.7) on CentOS 5 (in this tutorial I am installing Subversion on Cent OS 5.9).</p>
<p>Subversion Installation<br />
First, if you don&#8217;t require Subversion 1.7, installing Subversion using command line is very easy: >> yum install subversionAt the time of writing this the default yum install of Subversion installs the Subversion 1.6 version. You can check what version yum will install by using command line: >> yum list available | grep subversion<br />
If you want Subversion 1.7 installed (which is much better in my opinion than 1.6) you first have to download Subversion 1.7 from here: http://opensource.wandisco.com/centos/5/devel/RPMS/x86_64/.</p>
<p>If you already have Subversion installed and want to switch to Subversion 1.7 you can remove Subversion with: >> yum remove subversion*<br />
Here is an example of how to download and install Subversion 1.7: >> wget http://opensource.wandisco.com/centos/5/devel/RPMS/x86_64/subversion-1.7.9-1.x86_64.rpm /home/tmpNow, install the package: >> rpm -ivh /home/tmp/subversion-1.7.9-1.x86_64.rpmFinally, check version and you should see something like this: >> svn &#8211;version<br />
svn, version 1.7.9 (r1462340)<br />
compiled Mar 29 2013, 19:59:15<br />
Creating a Subversion Repository<br />
Now we can setup a Subversion repository. First create a directory where the Subversion subversion repository(ies) can reside: >> mkdir /var/svnNow create Subversion repository: >> svnadmin create /var/svn/myrepoThen set correct user/group: >> chown -R myuser:myuser /var/svn/myrepoThen set correct permissions: >> chmod -R 755 /var/svn/myrepoNow your Subversion repository should look something like: myrepo<br />
|&#8211; README.txt<br />
|&#8211; conf<br />
| |&#8211; authz<br />
| |&#8211; passwd<br />
| `&#8211; svnserve.conf<br />
|&#8211; db<br />
| |&#8211; current<br />
| |&#8211; format<br />
| |&#8211; fs-type<br />
| |&#8211; fsfs.conf<br />
| |&#8211; min-unpacked-rev<br />
| |&#8211; rep-cache.db<br />
| |&#8211; revprops<br />
| | `&#8211; 0<br />
| | `&#8211; 0<br />
| |&#8211; revs<br />
| | `&#8211; 0<br />
| | `&#8211; 0<br />
| |&#8211; transactions<br />
| |&#8211; txn-current<br />
| |&#8211; txn-current-lock<br />
| |&#8211; txn-protorevs<br />
| |&#8211; uuid<br />
| `&#8211; write-lock<br />
|&#8211; format<br />
|&#8211; hooks<br />
| |&#8211; post-commit.tmpl<br />
| |&#8211; post-lock.tmpl<br />
| |&#8211; post-revprop-change.tmpl<br />
| |&#8211; post-unlock.tmpl<br />
| |&#8211; pre-commit.tmpl<br />
| |&#8211; pre-lock.tmpl<br />
| |&#8211; pre-revprop-change.tmpl<br />
| |&#8211; pre-unlock.tmpl<br />
| `&#8211; start-commit.tmpl<br />
`&#8211; locks<br />
|&#8211; db-logs.lock<br />
`&#8211; db.lock<br />
Subversion Server Configuration<br />
Next, we need to make a global &#8216;svnserve.conf&#8217; file for all repositories (this is the easiest way to do it in my opinion, but you can have separate &#8216;svnserve.conf&#8217; files for each Subversion repository).</p>
<p>Copy &#8216;svnserve.conf&#8217; from repository to /var/svn >> cp -v /var/svn/myrepo/conf/svnserve.conf /var/svnNow edit &#8216;/var/svn/svnserve.conf&#8217;: >> nano /var/svn/svnserve.confSo it looks something like: [general]<br />
anon-access = none<br />
auth-access = write<br />
password-db = /var/svn/passwd<br />
realm = My Subversion ServerNext, create backup copy of &#8216;svnserve.conf&#8217;: >> mv -v /var/svn/myrepo/conf/svnserve.conf /var/svn/myrepo/conf/svnserve.conf.BAKCreate symlink to svnserve.conf: >> ln -s /var/svn/svnserve.conf /var/svn/myrepo/conf/svnserve.conf<br />
Create Subversion Users<br />
Next, we need to create the users/passwords files: >> nano /var/svn/passwdAdd users/passwords so your file looks something like:[users]<br />
shay = mypass<br />
mike = hispassSave file and close, set permissions:>> chmod 644 /var/svn/passwd<br />
Start the Subversion Server<br />
We can now start the svnserve server: >> svnserve -dr /var/svn(-d option: daemon mode, -r option: root of directory to serve)</p>
<p>You can now test accessing the Subversion repository by checking out repository: >> svn checkout file:///var/svn/myrepo /home/myproj<br />
Setting up Post Commit Hook<br />
Finally, here is how to setup a Subversion hook that will auto update a project directory post commit: first, copy post-commit hook template file: >> cd /var/svn/myrepo/hooks<br />
>> cp -v ./post-commit.tmpl ./post-commitMake hook executable: >> chmod +x ./post-commitThen edit the &#8216;./post-commit&#8217; hook file so it looks something like:#!/bin/sh</p>
<p>sudo -u [shell user] /usr/bin/svn update /home/myproj &#8211;username [svn user] &#8211;password [svn password]Now you can test a commit and see if the update happens through the hook.</p>
<p>If you get an error like:&#8221;sudo: sorry, you must have a tty to run sudo&#8221;You can fix that error by editing &#8216;/etc/sudoers&#8217; file and disabling (comment out) tty:#Defaults requiretty<br />
Stopping the Subversion Server<br />
First, find process ID of &#8220;svnserve -dr /var/svn&#8221;:>> ps -aux | grep svnWhich should give you results like:root 9292 0.0 0.0 80284 1152 ? Ss 11:18 0:00 svnserve -dr /var/svnNow you can kill process using: >> kill -9 9292The daemon &#8216;svnserve&#8217; is no longer running.</p>
<p>Setting up Subversion Server to run on Server Boot<br />
We can now setup a script that will auto start the Subversion server (svnserve) when the machine boots. First, create the &#8216;svnserve&#8217; file in &#8216;/etc/init.d&#8217;: #!/bin/sh<br />
# chkconfig: 2345 95 20<br />
# description: svnserve {start|status|stop}<br />
# processname: /etc/init.d/svnserve</p>
<p># @file /etc/init.d/svnserve<br />
# @author Shay Anderson 05.13</p>
<p># repositories path<br />
REPOS=/var/svn</p>
<p># svnserve command<br />
SVN=svnserve<br />
SVN_OPT=&#8221;-dr&#8221;<br />
SVN_DESC=&#8221;Subversion Server Daemon ($SVN)&#8221;</p>
<p>start() {<br />
      echo &#8220;Starting $SVN_DESC&#8230;&#8221;<br />
      $SVN $SVN_OPT $REPOS<br />
      echo &#8220;Done.&#8221;<br />
      echo<br />
}</p>
<p>status() {<br />
      echo &#8220;$SVN_DESC status:&#8221;<br />
      ps -aux | grep &#8220;$SVN $SVN_OPT $REPOS&#8221;<br />
      echo<br />
}</p>
<p>stop() {<br />
      echo &#8220;Stopping $SVN_DESC&#8230;&#8221;<br />
      pkill -f $SVN<br />
      echo<br />
}</p>
<p>case &#8220;$1&#8243; in<br />
      start)<br />
            start<br />
            ;;<br />
      status)<br />
            status<br />
            ;;<br />
      stop)<br />
            stop<br />
            ;;<br />
      *)<br />
            echo &#8220;Usage: $0 {start|status|stop}&#8221;<br />
            echo<br />
            ;;<br />
esac</p>
<p>exit 1Make sure the file is executable: >> chmod +x /etc/init.d/svnserveNow you should be able to start, stop or restart the svnserve process by using this script: >> /etc/init.d/svnserve stop<br />
>> /etc/init.d/svnserve start<br />
>> /etc/init.d/svnserve status<br />
Next, to set this script to run &#8216;start&#8217; on server boot register the service: >> chkconfig &#8211;add /etc/init.d/svnserveNow, you can check if it is registered: >> chkconfig &#8211;list | grep svnserve<br />
svnserve 0:off 1:off 2:on 3:on 4:on 5:on 6:offIf you ever want to remove the registered service use: >> chkconfig &#8211;del /etc/init.d/svnserve</p>
<p>The install and configuration of Subversion 1.7 on CentOS 5.9 is complete.</p>
<p>http://www.shayanderson.com/linux/tutorial-install-and-configure-subversion-1-7-on-centos-5.htm</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=143</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS 5 or CentOS 6 Upgrade PHP to PHP 5.4 or PHP 5.5</title>
		<link>http://wan.6te.net/?p=141</link>
		<comments>http://wan.6te.net/?p=141#comments</comments>
		<pubDate>Fri, 06 Jun 2014 09:29:36 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=141</guid>
		<description><![CDATA[CentOS 5 or CentOS 6 Upgrade PHP to PHP 5.4 or PHP 5.5 By Shay Anderson on August 2013 This article describes how to upgrade to PHP 5.4 or PHP 5.5 on a CentOS 5 or CentOS 6 server. First, detect if any PHP packages are installed: # yum list installed &#124; grep phpIf packages [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>CentOS 5 or CentOS 6 Upgrade PHP to PHP 5.4 or PHP 5.5<br />
By Shay Anderson on August 2013<br />
This article describes how to upgrade to PHP 5.4 or PHP 5.5 on a CentOS 5 or CentOS 6 server.</p>
<p>    First, detect if any PHP packages are installed:<br />
    # yum list installed | grep phpIf packages are installed remove them, for example:<br />
    # yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64<br />
    Add PHP 5.4 packages to yum using this command for CentOS 5.x<br />
    # rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpmOr, for CentOS 6.x:<br />
    # rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm<br />
    Now, you can check if the new PHP (5.4: php54w or 5.5: php55w) packages are available:<br />
    # yum list available | grep phpOr, version specific search:<br />
    # yum list available | grep php54<br />
    Next, install the new PHP 5.4 or 5.5 packages, for example when installing PHP 5.4 packages I used:<br />
    # yum install php54w.x86_64 php54w-cli.x86_64 php54w-common.x86_64 php54w-gd.x86_64 php54w-ldap.x86_64 php54w-mbstring.x86_64 php54w-mcrypt.x86_64 php54w-mysql.x86_64 php54w-pdo.x86_64<br />
    PHP should now be upgraded to the new version, you can verify with the command:<br />
    # php -v<br />
    PHP 5.4.17 (cli) (built: Jul 23 2013 00:02:04)<br />
    Copyright (c) 1997-2013 The PHP Group<br />
    Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies<br />
    Finally, restart the Web server: # service httpd restart</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=141</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set SSH Login Message or User Notice</title>
		<link>http://wan.6te.net/?p=139</link>
		<comments>http://wan.6te.net/?p=139#comments</comments>
		<pubDate>Fri, 06 Jun 2014 09:28:34 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=139</guid>
		<description><![CDATA[Set SSH Login Message or User Notice By Shay Anderson on July 2013 You can set a custom login message/banner or user notice/warning on your server by following these instructions. First, create the login message (banner): # nano /etc/ssh/bannerThen add the message you want to be displayed on SSH login, for example: *************************************************************************** NOTICE TO [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Set SSH Login Message or User Notice<br />
By Shay Anderson on July 2013<br />
You can set a custom login message/banner or user notice/warning on your server by following these instructions.</p>
<p>First, create the login message (banner): # nano /etc/ssh/bannerThen add the message you want to be displayed on SSH login, for example: ***************************************************************************<br />
NOTICE TO USERS</p>
<p>This computer system is the private property and is NOT for public use.<br />
It is for authorized use only. Log off immediately if you are not an<br />
allowed authorized user of this system.<br />
****************************************************************************Next, set the banner path in the /etc/ssh/sshd_config file: Banner /etc/ssh/bannerFinally, restart the SSH service, on my Ubuntu server I do with command: # service ssh restartNext time a login is completed the banner should be displayed</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=139</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx Block Directory Access but Allow Internal Access for Rewrites</title>
		<link>http://wan.6te.net/?p=137</link>
		<comments>http://wan.6te.net/?p=137#comments</comments>
		<pubDate>Fri, 06 Jun 2014 09:27:47 +0000</pubDate>
		<dc:creator><![CDATA[saisai]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://wan.6te.net/?p=137</guid>
		<description><![CDATA[Nginx Block Directory Access but Allow Internal Access for Rewrites By Shay Anderson on November 2013 I recently came across a situation where I needed to block external/public access to a directory on a nginx Web server, but I needed to allow rewrites (particularly PHP rewrites) to work in the protected directory. Here is an [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Nginx Block Directory Access but Allow Internal Access for Rewrites<br />
By Shay Anderson on November 2013<br />
I recently came across a situation where I needed to block external/public access to a directory on a nginx Web server, but I needed to allow rewrites (particularly PHP rewrites) to work in the protected directory. Here is an example, I need this type of request blocked: /src/something.php (block)But, I need a request like: /page/something.php (allow)rewritten so it directs the request internally to: /src/something.php (internal => allow)After much troubleshooting, and being more experience with Apache, I came up with a solution.</p>
<p>First, I am using PHP-FPM with nginx, so I separate the PHP-FPM / FastCGI logic in a separate file, I create the file /etc/nginx/php.conf and add the following: try_files $uri =404;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;<br />
include fastcgi_params;Next, in my nginx virtual hosts configuration file (/etc/nginx/conf.d/default.conf) I add the following lines to protect my src directory from public requests: location /src {<br />
      internal;</p>
<p>      location ~ ^/src(.*\.php)$ {<br />
            include php.conf;<br />
      }<br />
}And down below these lines I also include a *.php block: location ~ \.php$ {<br />
      include php.conf;<br />
}<br />
This works because as soon as a public request comes in as /src/* it is blocked (or not found) because of the internal syntax. However, I still need my PHP files to work for internal requests, and therefore I include my location ~ ^/src(.*\.php)$ block. If I didn&#8217;t include this block then nginx would use the last *.php block in the config file, which wouldn&#8217;t block public PHP requests in the src directory.</p>
<p>http://www.shayanderson.com/linux/nginx-block-directory-access-but-allow-internal-access-for-rewrites.htm</p>
]]></content:encoded>
			<wfw:commentRss>http://wan.6te.net/?feed=rss2&#038;p=137</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
