moxiefoxtrot

…a random blog about life and technology

Archive for the ‘php’ tag

PowerDNS web frontend

24 comments

A couple years ago I was working on project to manage PowerDNS via the web called MoxieDNS. Unfortunately, it got put on the back burner because of other projects. However, I decided to revive the project in limited form, cleanup the code and release it to the public in hopes someone will be able to expand upon it. In its current state, the application works. However, there are bugs and inconsistencies.

The goals behind creating the project were pretty simple:

  • End User: Allow for the creation of DNS templates for fast deployment
  • End User: Create primary DNS and secondary DNS for domains.
  • End User: Add URL forwarding
  • End User: Add DNS records A, AAAA, MX, PTR, CNAME, TXT, SRV
  • Admin: Create/delete/modify users
  • Admin: Put application in maintenance mode (do not allow modifications to records)
  • Admin: Set domain, template, url forward limits for users
  • Admin: Manage application settings, dns servers, TTL times etc.
  • Admin: Billing module (not completed)
  • Admin: Set per domain query limits (not completed)
  • General: Per user logging
  • General: Simple/clean interface for managing records.
  • General: PHP, mySQL back-end, using PEAR DB modules to allow for fast porting to other SQL platforms
  • General: Full permission system

Some of the known issues with the project include:

  • Interface bugs, not redirecting correctly after making changes
  • Browser compatibility issues (not compliant by any means)
  • Dirty code
  • Logging needs to be improved
  • Possible internal permission issues (need code auditing to verify)
  • Priority edit field shows on records other then MX
  • Adding secondary dns is broke (template issue)
  • I’m sure there are more :)

I set up a end user demo at http://xlogicgroup.com/dns/ login: test , password: test

For anyone interested in checking it out until its released. The current demo has a max of 20 test domains.

Written by Ryan

January 7th, 2009 at 11:15 am

Posted in General, Ubuntu Planet

Tagged with , ,

Install nginx w/ php5 on Ubuntu 8.10

11 comments

Below are the steps I took to configure nginx and php5 on my Ubuntu 8.10 server. I choose nginx because its lightweight and relatively easy to manage once you figure out the configuration. I’ve been using Apache for years and its second nature at this point, however, on my small VPS server I needed to maximize my resources.

Make sure your system is updated:

sudo aptitude update && sudo aptitude safe-upgrade

Install nginx and PHP5, we’ll be installing the cgi version of php.

sudo aptitude install nginx php5-cgi

Download the following php-fastcgi startup script and save it to /etc/init.d/php-fastcgi. Nginx will use php in cgi-mode which is why we are creating a init file for it. (note: I found this init script on a mailing list someplace)

Download: php-fastcgi init script

Next, run the following commands on the php-fastcgi script.

sudo chmod u+x /etc/init.d/php-fastcgi
sudo chown 0.0 /etc/init.d/php-fastcgi
sudo update-rc.d php-fastcgi defaults 21 23

Now, go ahead and create your directory that will store your website. For example you might do the following:

mkdir -p /home/username/domains/yourdomaincom/{public_html,log,cgi-bin}

Modify the /etc/nginx/nginx.conf file and set the following variable. I have mine set to 15MB but if you wish to allow larger files to be uploaded over http set this accordingly.

client_max_body_size 15m;

Finally, lets setup a virtual domain. Navigate to the /etc/nginx/sites-available directory and create a file called yourdomain.com (replace with your domain) and use the following as a template. Make sure to replace your paths etc.

server {
listen  80;
server_name  yourdomain.com www.yourdomain.com;

access_log  /home/username/domains/yourdomain.com/log/access.log;

location / {
root   /home/username/domains/yourdomain.com/public_html;
index  index.html index.htm index.php;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /home/username/domains/yourdomain.com/public_html$fastcgi_script_name;
include fastcgi_params;
}
}

Like apache, nginx has a sites-available and sites-enabled folder this allows for better control of active/disabled virtual domains. Navigate to the /etc/nginx/sites-enabled folder and create a symlink back to your virtual host’s configuration.

cd /etc/nginx/sites-enabled/ && sudo ln -s ../sites-available/yourdomain.com

Finally, lets start everything up.
/etc/init.d/php-fastcgi start
/etc/init.d/nginx start

At this point you should be able to browse to your site using your domain name. You can easily duplicate multiple domains by creating new virtual host files and creating the sym link as noted above, remember that ngix will need to be restarted.

Written by Ryan

December 1st, 2008 at 3:47 pm

Posted in Articles & Reviews, Ubuntu

Tagged with , , ,