<div dir="ltr">Thank you very much for the detailed instructions.<br>I&#39;ll try it and report the results.<br><br><div class="gmail_quote">On Wed, Aug 11, 2010 at 6:36 AM, Raina Gustafson <span dir="ltr">&lt;<a href="mailto:raina@thequeensmen.com">raina@thequeensmen.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Pablo,<br>
<br>
Ok. Here are notes/commands that worked successfully for me when<br>
installing PHP-FPM, Nginx and Magento on a Media Temple (ve) loaded<br>
with CentOS. My notes are a little messy. Let me know if you get stuck<br>
with anything, though if the process is significantly different for<br>
Ubuntu I might not be able to help. I&#39;ve also pasted my config files<br>
below.<br>
<br>
INSTALL DEPENDENCIES<br>
yum install -y curl-devel gcc GeoIP* httpd-devel libevent<br>
libevent-devel libjpeg-devel libmcrypt-devel libpng-devel<br>
libtool-ltdl-devel libxml2 libxml2-devel mysql mysql-devel<br>
mysql-server openssl-devel patch pcre-devel php-gd php-mcrypt<br>
php-mysql php-pdo php-xml spawn-fcgi xmlrpc zlib-devel<br>
<br>
yum install php* ???<br>
<br>
DOWNLOAD OWN LIBEVENT RATHER THAN YUM<br>
<a href="http://forum.nginx.org/read.php?3,30050" target="_blank">http://forum.nginx.org/read.php?3,30050</a><br>
-&gt; mkdir /opt/libevent<br>
-&gt; cd /opt/libevent<br>
-&gt; wget <a href="http://monkey.org/%7Eprovos/libevent-1.4.13-stable.tar.gz" target="_blank">http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz</a><br>
-&gt; tar xvf libevent...<br>
<br>
<br>
PHP: COMPILE AND INSTALL FIRST<br>
# this was the most helpful<br>
<a href="http://interfacelab.com/nginx-php-fpm-apc-awesome/" target="_blank">http://interfacelab.com/nginx-php-fpm-apc-awesome/</a><br>
# helpful but failed<br>
<a href="http://adityo.blog.binusian.org/?p=428" target="_blank">http://adityo.blog.binusian.org/?p=428</a><br>
# didn&#39;t use these but they look good<br>
<a href="http://www.newmediaist.com/n/installing-nginx-mysql-php-fpm-xcache-centos-53-howto" target="_blank">http://www.newmediaist.com/n/installing-nginx-mysql-php-fpm-xcache-centos-53-howto</a><br>
<a href="http://www.linode.com/forums/viewtopic.php?p=26342" target="_blank">http://www.linode.com/forums/viewtopic.php?p=26342</a><br>
<br>
./configure --enable-fpm --enable-inline-optimization --enable-pdo<br>
--enable-soap --enable-sockets --enable-zip --with-curl --with-gd<br>
--with-jpeg-dir --with-libdir=lib64 --with-mcrypt --with-mhash<br>
--with-mysql --with-mysqli=mysqlnd --with-openssl --with-pear<br>
--with-pdo-mysql=mysqlnd --with-zend-vm=GOTO --with-zlib<br>
<br>
make<br>
make test<br>
make install<br>
<br>
Wrote PEAR system config file at: /usr/local/etc/pear.conf<br>
You may want to add: /usr/local/lib/php to your php.ini include_path<br>
/usr/local/src/php-5.3.3/build/shtool install -c ext/phar/phar.phar<br>
/usr/local/bin<br>
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar<br>
Installing PDO headers:          /usr/local/include/php/ext/pdo/<br>
<br>
#strip /usr/local/bin/php-cgi<br>
<br>
PHP: CONFIG<br>
/usr/local/etc/php-fpm.conf<br>
<br>
INSTALLING NGINX<br>
wget <a href="http://sysoev.ru/nginx/nginx-0.7.67.tar.gz" target="_blank">http://sysoev.ru/nginx/nginx-0.7.67.tar.gz</a><br>
<a href="http://wiki.nginx.org/NginxInstallOptions" target="_blank">http://wiki.nginx.org/NginxInstallOptions</a><br>
<br>
./configure \<br>
  --prefix=/ \<br>
  --sbin-path=/usr/sbin/nginx \<br>
  --conf-path=/etc/nginx/nginx.conf \<br>
  --error-log-path=/var/log/nginx/error.log \<br>
  --pid-path=/var/run/nginx/nginx.pid  \<br>
  --lock-path=/var/lock/nginx.lock \<br>
  --with-http_geoip_module \<br>
  --without-http_autoindex_module \<br>
  --with-http_stub_status_module \<br>
  --user=nginx \<br>
  --group=nginx \<br>
  --with-http_ssl_module \<br>
  --with-http_flv_module \<br>
  --with-http_gzip_static_module \<br>
  --http-log-path=/var/log/nginx/access.log \<br>
  --http-client-body-temp-path=/var/tmp/nginx/client/ \<br>
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \<br>
  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/<br>
<br>
make &amp;&amp; make install<br>
<br>
NGINX SYMLINK (USUALLY CREATED AUTOMATICALLY ON INSTALL)<br>
ln -s /usr/local/nginx/conf /etc/nginx<br>
OR MOVE LOCATION<br>
cd /usr/local/src/nginx...<br>
cp -a nginx-0.7.67 ../nginx<br>
<br>
#be sure to set the correct paths<br>
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br>
<br>
TO START WEBSERVER<br>
uncomment &#39;nobody&#39; in /etc/nginx/nginx.conf<br>
create init:<br>
<a href="http://wiki.nginx.org/RedHatNginxInitScript" target="_blank">http://wiki.nginx.org/RedHatNginxInitScript</a><br>
/etc/init.d/nginx<br>
<br>
TODO<br>
#integrate apc<br>
<a href="http://www.chilipepperdesign.com/2009/12/18/configuring-and-compiling-nginx-and-php-fpm-on-ubuntu-for-magento-part-2%0A#get" target="_blank">http://www.chilipepperdesign.com/2009/12/18/configuring-and-compiling-nginx-and-php-fpm-on-ubuntu-for-magento-part-2<br>

#get</a> ssl working<br>
#add these to server boot<br>
/etc/init.d/php_cgi start<br>
mysql<br>
service mysqld start<br>
review php and nginx configuration options<br>
<br>
<br>
INSTALL MYSQL<br>
5.0.77 Source distribution<br>
<a href="http://forums.mysql.com/read.php?11,153632" target="_blank">http://forums.mysql.com/read.php?11,153632</a><br>
chgrp -R mysql /var/lib/mysql<br>
chmod -R 770 /var/lib/mysql<br>
chkconfig mysqld on &amp;&amp; service mysqld restart &amp;&amp; chkconfig --list | grep mysqld<br>
service mysqld start<br>
/usr/bin/mysqladmin -u root password &#39;password&#39;<br>
<br>
TROUBLESHOOTING<br>
one ve2, had to use 127.0.0.1 instead of localhost, had to skip base<br>
url validation, and had to change root password as follows:<br>
<br>
update user set Password=PASSWORD(&#39;password&#39;) where user=&#39;user&#39;;<br>
or<br>
set Password=PASSWORD(&#39;password&#39;) where user=&#39;user&#39;;<br>
flush privileges;<br>
exit;<br>
<br>
<br>
INSTALL PEAR &amp; APC<br>
<a href="http://www.webtatic.com/blog/2009/06/php-530-on-centos-5/" target="_blank">http://www.webtatic.com/blog/2009/06/php-530-on-centos-5/</a><br>
#didn&#39;t work#<br>
#yum install nfs-utils<br>
#/sbin/service portmap start<br>
#/sbin/service nfslock start<br>
#/sbin/service nfs start<br>
##mount nfs -t /dev/simfs -o remount,exec /tmp<br>
##mount nfs -o remount,exec /tmp<br>
##/dev/simfs on /tmp type simfs (rw,noexec)<br>
##pecl install apc<br>
<a href="http://www.php.net/manual/en/install.pecl.phpize.php" target="_blank">http://www.php.net/manual/en/install.pecl.phpize.php</a><br>
#WORKS<br>
yum install autoconf<br>
<a href="http://constantshift.com/installing-apc-for-php-5-3/" target="_blank">http://constantshift.com/installing-apc-for-php-5-3/</a><br>
$ cd /usr/local/src<br>
$ wget <a href="http://pecl.php.net/get/APC-3.1.3p1.tgz" target="_blank">http://pecl.php.net/get/APC-3.1.3p1.tgz</a><br>
$ tar xzvf APC-3.1.3p1.tgz<br>
$ cd APC-3.1.3p1<br>
$ phpize<br>
$ ./configure --enable-apc --enable-mmap<br>
$ make<br>
$ make install<br>
$ cp /usr/local/src/APC-3.1.3p1/modules/apc.so<br>
/usr/local/lib/php/extensions/no-debug-non-zts-20090626/<br>
### ADD TO PHP.INI<br>
extension = apc.so<br>
apc.enabled=1<br>
apc.shm_size=30<br>
/etc/init.d/nginx restart &amp;&amp; /etc/init.d/php-fpm restart<br>
cp apc.php /var/www/html/<br>
<br>
INSTALL FASTCGI<br>
<a href="http://adityo.blog.binusian.org/?p=428" target="_blank">http://adityo.blog.binusian.org/?p=428</a><br>
 - change to --with-mysql=/usr/bin/mysql<br>
<br>
MAGENTO<br>
use magento check file<br>
<a href="http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento" target="_blank">http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento</a><br>

<br>
raised php.ini memory/timeout<br>
<br>
### END OF NOTES, START FILES###<br>
<br>
### /etc/nginx/nginx.conf ###<br>
<br>
user              nobody;<br>
worker_processes  4;<br>
error_log         /var/log/nginx/error.log;<br>
pid               /var/run/nginx.pid;<br>
<br>
events {<br>
    worker_connections  1024;<br>
}<br>
<br>
http {<br>
    include       /etc/nginx/mime.types;<br>
    default_type  application/octet-stream;<br>
<br>
    log_format  main  &#39;$remote_addr - $remote_user [$time_local] &quot;$request &quot;&#39;<br>
                      &#39;$status $body_bytes_sent &quot;$http_referer&quot; &#39;<br>
                      &#39;&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;&#39;;<br>
    access_log  /var/log/nginx/access.log  main;<br>
<br>
    sendfile        on;<br>
    map $scheme $fastcgi_https { ## Detect when HTTPS is used<br>
        default off;<br>
        https on;<br>
    }<br>
<br>
        client_body_timeout   5;<br>
        client_header_timeout 5;<br>
        keepalive_timeout     5 5;<br>
        send_timeout          5;<br>
<br>
    gzip  on;<br>
    gzip_comp_level 2;<br>
    gzip_proxied any;<br>
        gzip_static       on;<br>
        gzip_buffers      16 8k;<br>
        gzip_http_version 1.0;<br>
        gzip_min_length   0;<br>
        gzip_vary         on;<br>
    gzip_types      text/plain text/css application/x-javascript<br>
text/xml application/xml application/xml+rss text/javascript;<br>
<br>
    # Load config files from the /etc/nginx/conf.d directory<br>
    include /etc/nginx/conf.d/*.conf;<br>
<br>
}<br>
<br>
### /etc/nginx/conf.d/domain.conf ###<br>
<br>
server {<br>
    listen 80;<br>
    server_name <a href="http://domain.com" target="_blank">domain.com</a>;<br>
<br>
        root /var/www/html;<br>
<br>
    location / {<br>
        index index.html index.php; ## Allow a static html file to be<br>
shown first<br>
        try_files $uri $uri/    @handler; ## If missing pass the URI to<br>
Magento&#39;s front handler<br>
        expires                                 max; ## Assume all files are cachable<br>
        error_page                              404 = @handler;<br>
                log_not_found                   off;<br>
    }<br>
<br>
    location ~ /(.*)/index\.php$ { ## strip index.php from product urls<br>
        if (!-e $request_filename) { rewrite ^(.*)/index\.php$ $1/ permanent; }<br>
        }<br>
<br>
    location /minify/ { ## Needed for Fooman Speedster<br>
        rewrite ^/minify/([0-9]+)(/.*\.(js|css))$<br>
/lib/minify/m.php?f=$2&amp;d=$1 last;<br>
    }<br>
<br>
    ## These locations would be hidden by .htaccess normally<br>
    location /app/                { deny all; }<br>
    location /includes/           { deny all; }<br>
    location /lib/                { deny all; }<br>
    location /lib/minify/         { allow all; }  ## Deny is applied<br>
after rewrites so must specifically allow minify<br>
    location /media/downloadable/ { deny all; }<br>
    location /pkginfo/            { deny all; }<br>
    location /report/config.xml   { deny all; }<br>
    location /var/                { deny all; }<br>
<br>
    location /var/export/ { ## Allow admins only to view export folder<br>
        auth_basic           &quot;Restricted&quot;; ## Message shown in login window<br>
        auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword<br>
    }<br>
<br>
    location  /. { ## Disable .htaccess and other hidden files<br>
        return 404;<br>
    }<br>
<br>
    location @handler { ## Magento uses a common front handler<br>
        rewrite / /index.php;<br>
    }<br>
<br>
    location ~ \.php/ { ## Forward paths like /js/index.php/x.js to<br>
relevant handler<br>
        rewrite ^(.*\.php)/ $1 last;<br>
    }<br>
<br>
    location ~ \.php$ { ## Execute PHP scripts<br>
        expires                 off; ## Do not cache dynamic content<br>
        fastcgi_param   HTTPS $fastcgi_https;<br>
        fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;<br>
        fastcgi_param   PATH_INFO $fastcgi_script_name;<br>
        fastcgi_pass    <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>;<br>
        fastcgi_index   index.php;<br>
        fastcgi_param  MAGE_RUN_CODE  base;<br>
        fastcgi_param  MAGE_RUN_TYPE  website;<br>
        include                 fastcgi_params; ## See /etc/nginx/fastcgi_params<br>
    }<br>
<br>
}<br>
<br>
### END ###<br>
<br>
This is not necessarily the most optimal or logical configuration, but<br>
it works for me. It could probably be simplified, though you&#39;ll also<br>
likely want to at least add a server configuration for SSL.<br>
<br>
Hope that helps! Let me know how it goes for you.<br>
<br>
Best,<br>
<div class="im">Raina<br>
<br>
On Mon, Aug 9, 2010 at 9:29 PM, pablo platt &lt;<a href="mailto:pablo.platt@gmail.com">pablo.platt@gmail.com</a>&gt; wrote:<br>
</div><div><div></div><div class="h5">&gt; Hi,<br>
&gt;<br>
&gt; Anyone can share a working magento setup?<br>
&gt; I&#39;ve read that nginx outperforms apache but couldn&#39;t find a clear<br>
&gt; instructions how to setup on ubuntu:<br>
&gt; nginx + config file<br>
&gt; fcgi + spawn-fcgi + upstart script<br>
&gt; php-fpm<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
</div></div><div><div></div><div class="h5">&gt; _______________________________________________<br>
&gt; nginx mailing list<br>
&gt; <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
&gt; <a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
&gt;<br>
&gt;<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>