{"id":353,"date":"2009-05-26T15:46:30","date_gmt":"2009-05-26T08:46:30","guid":{"rendered":"http:\/\/adityo.blog.binusian.org\/?p=353"},"modified":"2009-05-26T15:46:30","modified_gmt":"2009-05-26T08:46:30","slug":"how-to-install-engine-x-nginx-and-php-fpm-in-freebsd","status":"publish","type":"post","link":"https:\/\/adityo.blog.binusian.org\/?p=353","title":{"rendered":"How to install Engine X (nginx) and php-fpm in FreeBSD"},"content":{"rendered":"<p>I have been recommend by my friend to use nginx for my wpmu server and compare it with the wpmu apache server, hmm an interesting idea, but since there is no server that available i need to wait until i get my hands on the available remain server. Okay the question know what is nginx actually , and do i need to use Ubuntu as the OS, since i see alot of big domain using freebsd and nginx so why not if i am trying Freebsd, if you want anotehr review about nginx and another web server <a href=\"http:\/\/royal.pingdom.com\/2008\/04\/17\/alternative-web-servers-compared-lighttpd-nginx-litespeed-and-zeus\/\">click here<\/a><\/p>\n<p>What is nginx ?<\/p>\n<p>a lightweight web server\/reverse proxy and e-mail (IMAP\/POP3) proxy, licensed under a BSD-like license<\/p>\n<p>okay i will try to install nginx from <a href=\"http:\/\/en.wikipedia.org\/wiki\/FreeBSD_Ports\">FreeBSD ports<\/a><\/p>\n<p>1. Go to nginx Freebsd port and start the installation<\/p>\n<p># cd \/usr\/ports\/www\/nginx<\/p>\n<p># make clean install<\/p>\n<p>You will see a choice of module component, you can choose what ever you want. Here is my choice:<\/p>\n<p>HTTP_MODULE<br \/>\nHTTP_REWRITE_MODULE<br \/>\nHTTP_SSL_MODULE<br \/>\nHTTP_STATUS_MODULE<\/p>\n<p>2. Install php from the Freebsd ports<\/p>\n<p># cd \/usr\/ports\/lang\/php5<br \/>\n# make clean install<\/p>\n<p>you will see another php module that you can pick for the php installation, i choose this module:<br \/>\nCLI<br \/>\nCGI<br \/>\nSUHOSIN<br \/>\nIPV6<br \/>\nFASTCGI<br \/>\nPATHINFO<\/p>\n<p>3. Installing php-fpm<\/p>\n<p>php-fpm &#8211; is a patch for php4\/5 to greatly improve FastCGI SAPI usage in production, <a href=\"http:\/\/translate.google.com\/translate?u=http%3A%2F%2Fphp-fpm.anight.org%2F&amp;hl=en&amp;ie=UTF8&amp;sl=ru&amp;tl=en\">click here<\/a> for more reference about php-fpm advantage\/ features<\/p>\n<p>#wget http:\/\/php-fpm.anight.org\/downloads\/freebsd-port\/php-5.2.6-fpm-0.5.9.tar.gz<\/p>\n<p>extract\u00a0 move it to ports directory and delete the sourcecode<\/p>\n<p># tar xvzf php5-fpm.5.2.6.tar.gz \u2013-directory=\/usr\/ports\/lang &amp;&amp; rm php5-fpm.5.2.6.tar.gz<\/p>\n<p>move to php5-fpm ports directory and installed<br \/>\n# cd \/usr\/ports\/lang\/php5-fpm\/ &amp;&amp; make install<\/p>\n<p>Again you will see list of module , and i choose:<\/p>\n<p>CLI<br \/>\nSUHOSIN<br \/>\nPATHINFO<\/p>\n<p>4. We need to configuring and update the nginx and php-fpm on rc.conf<\/p>\n<p># ee \/etc\/rc.conf<\/p>\n<p>Scroll down and add :<\/p>\n<p>nginx_enable=\u201dYES\u201d<br \/>\nphp_fpm_enable=\u201dYES\u201d<\/p>\n<p>5. We also need to configure nginx.conf on \/usr\/local\/etc\/nginx\/nginx.conf and edit the root directory path and add php component<\/p>\n<p># ee \/usr\/local\/etc\/nginx\/nginx.conf<\/p>\n<p>location \/ {<br \/>\nroot \/usr\/local\/www\/data;<br \/>\nindex index.php index.html index.htm;<br \/>\n}<br \/>\nlocation ~ \\.php$ {<br \/>\nfastcgi_pass 127.0.0.1:9000;<br \/>\nfastcgi_index index.php;<br \/>\nfastcgi_param SCRIPT_FILENAME \/usr\/local\/www\/data$fastcgi_script_name;<br \/>\ninclude fastcgi_params;<br \/>\n}<\/p>\n<p>i use \/usr\/local\/www\/data as my root directory that is why you need to set fastcgi_param SCRIPT_FILENAME to \/usr\/local\/www\/data$fastcgi_script_name if not you will found this error when you access your php file:<\/p>\n<p>\u201cNo <em>input file specified<\/em>.\u201d<\/p>\n<p>6. We need to edit php-fpm.conf to specify the user and group for php-fpm<\/p>\n<p>#ee \/usr\/local\/etc\/php-fpm.conf<\/p>\n<p>Find these lines :<\/p>\n<p>&lt;!\u2013 &lt;value name=\u201duser\u201d&gt;<strong>nobody<\/strong>&lt;\/value&gt; \u2013&gt;<br \/>\n&lt;!\u2013 &lt;value name=\u201dgroup\u201d&gt;<strong>nobody<\/strong>&lt;\/value&gt; \u2013&gt;<\/p>\n<p>change nobody into www<\/p>\n<p>&lt;value name=\u201duser\u201d&gt;<strong>www<\/strong>&lt;\/value&gt;<\/p>\n<p>&lt;value name=\u201dgroup\u201d&gt;<strong>www<\/strong>&lt;\/value&gt;<\/p>\n<p>7. Now you need tostart the nginx and php-fpm service<\/p>\n<p># \/usr\/local\/etc\/rc.d\/php-fpm start<br \/>\n# \/usr\/local\/etc\/rc.d\/nginx start<\/p>\n<p>8. NOw\u00a0 you just need to test your nginx and php-fpm by going to your file www root and create phpinfo page to see the php version<br \/>\n# cd \/usr\/local\/www\/data<\/p>\n<p>ee test.php<br \/>\n&lt;?<br \/>\nphpinfo();<br \/>\n?&gt;<\/p>\n<p>Now access it:<\/p>\n<p>http:\/\/localhost\/test.php<\/p>\n<p><a href=\"http:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-354\" title=\"nginx1\" src=\"http:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx1.png\" alt=\"nginx1\" width=\"500\" height=\"413\" srcset=\"https:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx1.png 500w, https:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx1-300x247.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-355\" title=\"nginx2\" src=\"http:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx2.png\" alt=\"nginx2\" width=\"521\" height=\"58\" srcset=\"https:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx2.png 601w, https:\/\/adityo.blog.binusian.org\/files\/2009\/05\/nginx2-300x33.png 300w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been recommend by my friend to use nginx for my wpmu server and compare it with the wpmu apache server, hmm an interesting idea, but since there is no server that available i need to wait until i get my hands on the available remain server. Okay the question know what is nginx [&hellip;]<\/p>\n","protected":false},"author":386,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[489,1887],"tags":[],"class_list":["post-353","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-nginx"],"_links":{"self":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/users\/386"}],"replies":[{"embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=353"}],"version-history":[{"count":2,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/353\/revisions"}],"predecessor-version":[{"id":357,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/353\/revisions\/357"}],"wp:attachment":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}