Welcome Guest, Not a member yet? Register   Sign In
Setting up perfect server config for codeigniter
#1

[eluser]megamonk[/eluser]
Hi,

been using CI for quite a while now and i have encountered many times that my site doesnt work "out of the box" when i migrate on the production server without doing some 'fixes' either on the config file of CI, the htaccess or the server config itself.

Now im given a chance to setup a "clean" linux box and install apache, php, mysql remotely via shell. My system administration skills is very basic so can anyone teach me how to install those and 'configure' it to work flawlessly with codeigniter? of course it will have to be able to host multiple sites. i know this is kinda asking too much but i would greatly appreciate the help.

Thanks!
#2

[eluser]pbreit[/eluser]
My experience is that CodeIgniter works quite well "out-of-the-box" on a wide variety of *nix environments. I don't think you need to do anything too fancy. You mention needing to do various fixes. Can you elaborate on what they typically are? The only thing I've had much trouble with is the .htaccess/mod_rewrite to get rid of index.php but that's generally a tricky topic.
#3

[eluser]mi6crazyheart[/eluser]
CodeIgniter don't need any extra server setting to install properly. It's absolutely too easy to install & config. Just follow the instruction as it has been written in user_guide. That's all...
#4

[eluser]megamonk[/eluser]
here are few examples of problems i usually encounter:

no mod_rewrite
php version below 5.3 ($_request variable includes cookies where ci_session var is stored)
$_post doesnt work or disabled
having problem figuring out correct 'uri protocol' sometimes i tried all 5 options already but still doesnt work only to find out i need to put "?" after index file then try the 5 options again.
no compression support

and many more....

all in all my goal is to know what would be the perfect server config for it and how to set it up that the only thing i have to worry about would be changing the base url in the config file and the database connection and thats it. figuring out how to configure a site everytime i migrate to production then adjusting code accordingly to make it work in the production server simply waste time. i develop using lampp but i cant use lampp as a production server. while it makes sense to make sure that the development and server environment is the same, that really is not possible especially with developers working remotely and setting up their own development server so the next best thing i could think of is to ensure that CI will work 100% with the server. no guessing or troubleshooting what went wrong or why my app doesnt work when it works flawlessly on development server
#5

[eluser]BrianL[/eluser]
I have recently done this. I can set up php.ini and my.cnf exactly how I want it, and I use lighttpd so I don't need to mess around with .htaccess because it doesn't exist. It is far more secure than standard codeigniter installs, because I have PHP and MySQL chrooted and CodeIgniter and phpMyAdmin above the webroot, inaccessible. I have self-signed certificates, and firewall rules to restrict access to sensitive directories like the phpMyAdmin directory (which is of course renamed to random). I can host as many sites as I want. This is all done through http://www.rackspacecloud.com/cloud_host...ts/servers so it is scalable as much as I want. SSH is only accessible through keys, not passwords so my server is immune to brute force attacks. I transfer my files through SFTP not FTP. Et cetera et cetera.

But I have systems administration experience Wink.

The problem is the "perfect server config" requires multidisciplinary skills. Mostly systems administration but also a lot of scripting and experience what works and what doesn't. Security is a major issue. For example http://www.auscert.org.au/5816 is just a minor start on the security issues.

It sounds like you want this instead:
http://www.getcloudigniter.com/

Yes paying 5-10 dollars for each codeigniter site is far more expensive than paying ten dollars and setting up a vps. But to get such systems administration skills takes months to years, and to hire one is 15-25 an hour. Since your primary concern is configurability, not cost, you should be able to find a webhost that will give you everything you want without wasting time learning systems admin.

P.S. If you are absolutely sure you want to learn systems administration (which will take 6 months to one year) send me a PM and I can send you 100 links to read. But again as a coder, I do not believe it is worth your time. If you think you are wasting time setting up CodeIgniter you haven't tried setting up NFS server for Tripwire intrusion detection or getting sendmail binary to work in a chroot!
#6

[eluser]pbreit[/eluser]
I still think you want to take the opposite approach: set up your servers how you want and then get CodeIgniter working (it will probably "just work" anyway). The problems that you run into are frequently because hosting providers "lock down" their servers. But if you are running your own servers things should be fine.
#7

[eluser]BrianL[/eluser]
Well one obvious solution to this "production environment vastly different than development environment" issue, or "pain in the ass after I think I'm totally done coding" issue is to work directly on your future production server. That way you never run into issues such as production environment not supporting mod rewrite, or not supporting PHP5 and having to rewrite huge swaths of code.

That is, protect your server with HTTP Auth and a self-signed SSL cert, along with a robots.txt so the site doesn't get indexed on Google. When you are ready to "go live" simply remove the HTTP Auth and alter robots.txt and your site is in production mode, with no transition time at all.

Such approach requires care though, a checklist of php directives and CodeIgniter issues to remove before going live. For example, error reporting and scaffolding should be turned off. But this checklist should exist anyway. This is also better if you have full root access so you can alter firewall rules and have additional protection besides HTTP Auth.




Theme © iAndrew 2016 - Forum software by © MyBB