Category Archives: server
Hi,
when you have several virtualhosts with SSL enabled and also, the certificate has been generated with a pass phrase, you need to use SSLPassPhraseDialog to print to apache the password each time it starts, the problem comes as this directive can only be declared 1 time in the general configuration, so to use several password for each SSL generated, you can use this code:
#!/bin/sh
PASS1=”password1″
PASS2=”password2″case $1 in
www.url1.com:443) echo $PASS1;;
www.url2.com:443) echo $PASS2;;
esacexit 0
just replace the passwords and url with the one configured on your webserver, set them execution permission and add this to your apache conf:
SSLPassPhraseDialog exec:/path/to/bash/file
Regards,
Shadow.
Related Post
Hi,
i’m migratin a server, and i’m installing everything from source, so, the old server have subversion too, and after installing apache, mysql and php, i need it and configure it to use DAV for user authentication. for my surprise the apache source comes with the dav module do not include the mod_dav_svn and mod_authz_svn, and i found almost no info of how to make it work.
so to everyone who need it, just add the –with-apr flag when you configure the subversion source, like this:
./configure –with-apr=/usr/local/apache2/bin/apr-1-config
of course, your compiled version of apache needs to have apr, adding the flag “–with-included-apr” will do the trick
then use make and make install, automatically will place the modules on the apache module directory and you will be able to load it from there.
when you restart apache loading this modules, found any missing library or shared object error, check that the file is on /usr/local/lib and /usr/lib depending your apache configuration. it should be in at least 1 of those locations, to fix it, i just created a symbolic link of the file in the missing location and that fixed the problem.
i hope this will be useful for you
Regards,
Shadow.
Related Post
Hi,
recently i moved some scripts to a new server, so i was needed to reinstall everything from the old one. this has been also a change of platform, as the old was on a debian lenny, and this new one was a RHEL 6.0. in resume, here are the instructions of how to install imagick and support it on your php installation for any redhat based distribution:
yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick
echo “extension=imagick.so” > /etc/php.d/imagick.ini
service httpd restart
of course, change i386 with your architecture (like x86_64) and also, you need to install php-pear package to be able to use pecl and install the php extension.
i hope you find this useful
Regards,
Shadow.
Related Post
Hi,
today i wanted to give some common and not so common ideas of how to improve the performance of your web app. as you know, when you have a busy website, the performance (and along with the stability) is a key factor to have your project up and running, in this cases, you need to try to improve every aspect of your app, that is the idea, to help you to identify what can be or not be done in your case.
Database Optimization
Build a efficient database schema is not something easy, it cost time, study and testing to do it. at the time to build a efficient DB schema you need to take in consideration the following:
*Use the minimum columns as possible, and choose wisely the type of data that the database will store (if you will store number of 3 digit max, set a int(3) and not a varchar, text or a int(20))
*use the relational model, for dynamic or multiple values, use a index pattern where you have the definition of the data in 1 table and the data itself inserted by the user in other. do not create tons of columns as value_1, value_2 etc..
*add indexes to your tables
*use the primary key and unique key for columns that should have unique values to avoid data corruption or misbehavior.
in cases of the query, try to group the query’s in the less quantity of calls, use JOIN’s, select only the columns that you will really going to use, don’t make generals select’s. in case you need to return the number of something, use functions as SUM() and not mysql_num_rows().
Clean and re-usable code
you need to be careful at coding too, even that php bring a big liberty whiteout having to worry about types and variable types, you need to be responsible for what you write. the php code get messy when you do messy stuff. organize variables, functions and classes as much as you can. i’ll recommend to use a MVC model if is possible (even that before i rejected it) and a framework will also make you life easier when you learn how to use it.
there is always a good practice separate the logic from the view (i mean the main php code from the design), for this you can grab any framework, most of them already support this or get a template engine. i have always used smarty, and is very flexible and you can extend it with custom functions and modifiers, also it support time cache and others types too. even that i’m happy with it, and i’ll recommend to you, i have realized with the time that is a waste if time. it will never be faster than the normal php code, so if you want to go really well, i’ll recommend you to get a or build a class that will just load the php script as templates and that’s it. you will save time from learning a template script and save process in the meantime
cache everything
this is one of the most important thing of all. the cache is the base of any optimization. let say true, most of the pages of any app doesn’t change and if they change dynamically, is usually for a user action. if this happen you can use a selective caching, where you cache at the event if a action. make this type of cache is not a easy task, takes time and testing, but really it make great results on the practice and worth the time invested on it. the cache of css and js files is also a good technique, as well the compress of them.
use the power of javascript
i learning caching a lot of stuff to use the power of javascript. i have cached pages that needed to be refreshed each 20 seconds. surely you are asking how i made it, so basically i just cached them once and filtered the results with javascript after the ajax load of the filter using JSON and the html code from other call. if you are wondering if this is really a performance advantage, well yes, you will see a 50% of difference from a normal php processing. anyway, be careful with this type of technique, remember that javascript run on the client side, so the information passed there can be manipulated in evil ways. is a powerful tool that need to be used very careful. also, i will recommend you to use a javascript framework, they are cross browser compatible for almost all their functions, with a big community and plugins available, and heavily optimized.
i hope this help you in some way at the moment to optimize your web app’s
Regards,
Shadow.
Related Post
Hi,
i made other post’s about big blue button in the past, explaining you that was a great peace of open source software focused on delivering a e-learning platform. some days ago i was needed to install it on my job server as it will be integrated to a app we are working on.
so i followed the instructions here and i found some problem in the process that i will detail here, so you can save some time in the task:
bbb-conf don’t start the process:
i need to say that most of the process of installation have gone smoothly but the most biggest problem was that the script that should start everything never finished and get stuck at the start of the asterisk. the solution is to kill all the process that could maybe be working (tomcat,red5,openffice-headless,nginx,asterisk,activemq) and then start them manually in this order:
asterisk activemq bbb-openoffice-headless red5 tomcat6 nginx
bbb-openoffice-headless say that can’t open display X or don’t start
if this is happening to you, try with the commands described here. if that didn’t work, you need to install the package openoffice-headless, and then run:
bbb-openoffice-headless stop bbb-openoffice-headless start
BigBlueButton with apache and not nginx
if you have the same requirement like me, to run big blue button over apache and not nginx, you can follow this guide that is proved that works
if you find other problems, just follow the logic and check the logs of each one of the app’s involved on this (usually are on /var/log) when you found a specific problem there and don’t know how to solve it, you can post on the bbb-setup group for help. also, you can download the VM image their provide ready to use to compare that and your installation and find where is the problem.
i hope you find this useful
Regards,
Shadow.
Related Post
Hi,
you are doing a web app or something that requires the creation of a subdomain for a account/user feature/action and don’t know how to do it? i will give you some tips about it
normally, when you create a subdomain, you do it in your dns files/manager adding a CNAME record, that redirect to a new folder under your account or server. this is the normal process but is not dynamic/flexible to create subdomains on the fly, why require to touch server configuration files in the best of the cases (if you have a vps or a dedicated, why if you are on a shared account you need to use the control panel of your hosting company to do this).
in this case, we will be able to dynamically create/edit/delete any subdomain on the fly, using some persistence method to save the existent domains (like DB, files, variables etc..)
first of all, the biggest requirement is to config your domain as a wildcard domain, so any prefix added to the domain will be taken as valid. if you have access to the apache configuration files, open the one that have the virtualhost declaration of the domain and add the line:
ServerAlias *.your-domain-name.com
save and restart apache. if you are on a shared account, ask your hosting provider to do it, most of them will do it.
after this, we will create a .htaccess on the root of your web directory of the domain and paste this content in it:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !www.your-domain-name.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).your-domain-name.com [NC]
RewriteRule (.*) \/index.php?subdomain=%1 [QSA,L]
this code, will do the following:
1) check the the domain is not the domain + www prefix
2)check that the domain is a valid string (numbers, sign – _ and letters)
3) redirect to the index.php passing the subdomain as a GET parameters
this has been coded to send the subdomain as a get parameter to the php script, there you can check if the subdomain exists agains a db or any other persistent data as config files and do the necessary actions. of course that this subdomain detection can be done with php, but if you are in some conflict with other code, this solution could be handy, clean and effective.
i hope it help you in some way.
Regards,
Shadow.
Related Post
Hi,
this time i will write you a mini-howto install murmur and a administration panel, called MumPI.
What is murmur?
murmur is the server part of the open source voip communication program called Mumble. Mumble is a low latency voip program, that allow you communicate with several people on the same channel. murmur is the server part, the app that handle the communication between users.
Murmur installation
in debian is pretty easy to install it, just run the following apt-get
apt-get install mumble-server
that line will install murmur and set up as a service (like apache, mysql etc..) and run each time the machine booth. as any service, you can stop it, restart it, doing a /etc/init.d/mumble-server start|restart|reload|stop
now we need to install that will be the middle man between mumble server and MumPI, the php administration panel.
for this, just use this apt-get line:
apt-get install icecpp libzeroc-ice32 php-zeroc-ice lzma
for the current version of mumble and MumPI, check that you are installing ice 3.4, if not, go to ICEphp for a updated deb package. after the installation, open with your favorite editor:
/etc/mumble-server.ini
and look for a string like this:
ice="tcp -h 127.0.0.1 -p 6502"
if you don’t have it, add it after the dbus declaration.
now come the last step, go to MumPI website and download/extract the last version on your web end directory (i assume you already have apache and php configured for some domain)
after the extraction, just open the location with your browser and MumPI will be installed.
now, open
/etc/php5/conf.d/IcePHP.ini
and change the declaration of ice.slice to:
ice.slice=/path/to/MumPI/libs/Murmur122_fixed.ice
and that all folks ! now you can manage users, create virtual servers and enjoy of one of the best open source voip app out there
Regards,
Shadow.
Related Post
Hi,
long time since my last post right? sorry about that, too much work and things happening lately
.
this time i’m here to share the discover of a great tool that a friend of mine told me some days ago. is called selenium IDE. this tools comes in several formats, but what i’m interested in the FF addon version. this addon let you record user actions in a website, as login into a site, submit a form, click a link etc.. all of this can be recorded and reproduced anytime. this is useful why you can create a test suite of diferent’s actions for your app, and after you added some change or feature, you can run the test’s and know if something is not working.
selenium also accept scripting,in a markup language like xml where you can manually define actions, as waiting for some DOM object to show up, or some value to get set to launch an action.
i recommend you to take a look at it, will save you time and headaches in the future
you can download it from here.
Regards,
Shadow.
Related Post
Hi,
today i received a complaint from a user, that was receiving bounced errors to the emails sent to the server. so looking at the server, i see something like this:
Nov 21 17:36:00 li72-241 amavis[18844]: (18844-01) (!!)TROUBLE in check_mail: parts_decode_ext FAILED: file(1) utility (/usr/bin/file) error: run_command (open pipe): Can’t fork at /usr/lib/perl/5.10/IO/File.pm line 66, <GEN33> line 71. at /usr/sbin/amavisd-new line 2892, <GEN33> line 71.
so looking at google for some clues, as i didn’t changed anything on the server, i saw that this is a memory/resources related problem, so making a cat under /proc/meminfo i saw that the physical memory was low and the swap memory was all occupied, so i upgraded the swap memory. upgrading the physical memory will do the same but in this case it cost money
Regards,
Shadow.





