Welcome! Log In Create A New Profile

Advanced

Re: magento setup

pablo platt
August 19, 2010 11:38PM
Is nginx going to be faster than apache on a dev server with ~2 users
or am I going to see a difference only when having large number of
concurrent users?

On Wed, Aug 11, 2010 at 8:40 PM, pablo platt <pablo.platt@gmail.com> wrote:

> Thank you very much for the detailed instructions.
> I'll try it and report the results.
>
>
> On Wed, Aug 11, 2010 at 6:36 AM, Raina Gustafson <raina@thequeensmen.com>wrote:
>
>> Hi Pablo,
>>
>> Ok. Here are notes/commands that worked successfully for me when
>> installing PHP-FPM, Nginx and Magento on a Media Temple (ve) loaded
>> with CentOS. My notes are a little messy. Let me know if you get stuck
>> with anything, though if the process is significantly different for
>> Ubuntu I might not be able to help. I've also pasted my config files
>> below.
>>
>> INSTALL DEPENDENCIES
>> yum install -y curl-devel gcc GeoIP* httpd-devel libevent
>> libevent-devel libjpeg-devel libmcrypt-devel libpng-devel
>> libtool-ltdl-devel libxml2 libxml2-devel mysql mysql-devel
>> mysql-server openssl-devel patch pcre-devel php-gd php-mcrypt
>> php-mysql php-pdo php-xml spawn-fcgi xmlrpc zlib-devel
>>
>> yum install php* ???
>>
>> DOWNLOAD OWN LIBEVENT RATHER THAN YUM
>> http://forum.nginx.org/read.php?3,30050
>> -> mkdir /opt/libevent
>> -> cd /opt/libevent
>> -> wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gzhttp://monkey.org/%7Eprovos/libevent-1.4.13-stable.tar.gz
>> -> tar xvf libevent...
>>
>>
>> PHP: COMPILE AND INSTALL FIRST
>> # this was the most helpful
>> http://interfacelab.com/nginx-php-fpm-apc-awesome/
>> # helpful but failed
>> http://adityo.blog.binusian.org/?p=428
>> # didn't use these but they look good
>>
>> http://www.newmediaist.com/n/installing-nginx-mysql-php-fpm-xcache-centos-53-howto
>> http://www.linode.com/forums/viewtopic.php?p=26342
>>
>> ./configure --enable-fpm --enable-inline-optimization --enable-pdo
>> --enable-soap --enable-sockets --enable-zip --with-curl --with-gd
>> --with-jpeg-dir --with-libdir=lib64 --with-mcrypt --with-mhash
>> --with-mysql --with-mysqli=mysqlnd --with-openssl --with-pear
>> --with-pdo-mysql=mysqlnd --with-zend-vm=GOTO --with-zlib
>>
>> make
>> make test
>> make install
>>
>> Wrote PEAR system config file at: /usr/local/etc/pear.conf
>> You may want to add: /usr/local/lib/php to your php.ini include_path
>> /usr/local/src/php-5.3.3/build/shtool install -c ext/phar/phar.phar
>> /usr/local/bin
>> ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar
>> Installing PDO headers: /usr/local/include/php/ext/pdo/
>>
>> #strip /usr/local/bin/php-cgi
>>
>> PHP: CONFIG
>> /usr/local/etc/php-fpm.conf
>>
>> INSTALLING NGINX
>> wget http://sysoev.ru/nginx/nginx-0.7.67.tar.gz
>> http://wiki.nginx.org/NginxInstallOptions
>>
>> ./configure \
>> --prefix=/ \
>> --sbin-path=/usr/sbin/nginx \
>> --conf-path=/etc/nginx/nginx.conf \
>> --error-log-path=/var/log/nginx/error.log \
>> --pid-path=/var/run/nginx/nginx.pid \
>> --lock-path=/var/lock/nginx.lock \
>> --with-http_geoip_module \
>> --without-http_autoindex_module \
>> --with-http_stub_status_module \
>> --user=nginx \
>> --group=nginx \
>> --with-http_ssl_module \
>> --with-http_flv_module \
>> --with-http_gzip_static_module \
>> --http-log-path=/var/log/nginx/access.log \
>> --http-client-body-temp-path=/var/tmp/nginx/client/ \
>> --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
>> --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/
>>
>> make && make install
>>
>> NGINX SYMLINK (USUALLY CREATED AUTOMATICALLY ON INSTALL)
>> ln -s /usr/local/nginx/conf /etc/nginx
>> OR MOVE LOCATION
>> cd /usr/local/src/nginx...
>> cp -a nginx-0.7.67 ../nginx
>>
>> #be sure to set the correct paths
>> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
>>
>> TO START WEBSERVER
>> uncomment 'nobody' in /etc/nginx/nginx.conf
>> create init:
>> http://wiki.nginx.org/RedHatNginxInitScript
>> /etc/init.d/nginx
>>
>> TODO
>> #integrate apc
>>
>> http://www.chilipepperdesign.com/2009/12/18/configuring-and-compiling-nginx-and-php-fpm-on-ubuntu-for-magento-part-2
>> #get<http://www.chilipepperdesign.com/2009/12/18/configuring-and-compiling-nginx-and-php-fpm-on-ubuntu-for-magento-part-2%0A#get>ssl working
>> #add these to server boot
>> /etc/init.d/php_cgi start
>> mysql
>> service mysqld start
>> review php and nginx configuration options
>>
>>
>> INSTALL MYSQL
>> 5.0.77 Source distribution
>> http://forums.mysql.com/read.php?11,153632
>> chgrp -R mysql /var/lib/mysql
>> chmod -R 770 /var/lib/mysql
>> chkconfig mysqld on && service mysqld restart && chkconfig --list | grep
>> mysqld
>> service mysqld start
>> /usr/bin/mysqladmin -u root password 'password'
>>
>> TROUBLESHOOTING
>> one ve2, had to use 127.0.0.1 instead of localhost, had to skip base
>> url validation, and had to change root password as follows:
>>
>> update user set Password=PASSWORD('password') where user='user';
>> or
>> set Password=PASSWORD('password') where user='user';
>> flush privileges;
>> exit;
>>
>>
>> INSTALL PEAR & APC
>> http://www.webtatic.com/blog/2009/06/php-530-on-centos-5/
>> #didn't work#
>> #yum install nfs-utils
>> #/sbin/service portmap start
>> #/sbin/service nfslock start
>> #/sbin/service nfs start
>> ##mount nfs -t /dev/simfs -o remount,exec /tmp
>> ##mount nfs -o remount,exec /tmp
>> ##/dev/simfs on /tmp type simfs (rw,noexec)
>> ##pecl install apc
>> http://www.php.net/manual/en/install.pecl.phpize.php
>> #WORKS
>> yum install autoconf
>> http://constantshift.com/installing-apc-for-php-5-3/
>> $ cd /usr/local/src
>> $ wget http://pecl.php.net/get/APC-3.1.3p1.tgz
>> $ tar xzvf APC-3.1.3p1.tgz
>> $ cd APC-3.1.3p1
>> $ phpize
>> $ ./configure --enable-apc --enable-mmap
>> $ make
>> $ make install
>> $ cp /usr/local/src/APC-3.1.3p1/modules/apc.so
>> /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
>> ### ADD TO PHP.INI
>> extension = apc.so
>> apc.enabled=1
>> apc.shm_size=30
>> /etc/init.d/nginx restart && /etc/init.d/php-fpm restart
>> cp apc.php /var/www/html/
>>
>> INSTALL FASTCGI
>> http://adityo.blog.binusian.org/?p=428
>> - change to --with-mysql=/usr/bin/mysql
>>
>> MAGENTO
>> use magento check file
>>
>> http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
>>
>> raised php.ini memory/timeout
>>
>> ### END OF NOTES, START FILES###
>>
>> ### /etc/nginx/nginx.conf ###
>>
>> user nobody;
>> worker_processes 4;
>> error_log /var/log/nginx/error.log;
>> pid /var/run/nginx.pid;
>>
>> events {
>> worker_connections 1024;
>> }
>>
>> http {
>> include /etc/nginx/mime.types;
>> default_type application/octet-stream;
>>
>> log_format main '$remote_addr - $remote_user [$time_local] "$request
>> "'
>> '$status $body_bytes_sent "$http_referer" '
>> '"$http_user_agent" "$http_x_forwarded_for"';
>> access_log /var/log/nginx/access.log main;
>>
>> sendfile on;
>> map $scheme $fastcgi_https { ## Detect when HTTPS is used
>> default off;
>> https on;
>> }
>>
>> client_body_timeout 5;
>> client_header_timeout 5;
>> keepalive_timeout 5 5;
>> send_timeout 5;
>>
>> gzip on;
>> gzip_comp_level 2;
>> gzip_proxied any;
>> gzip_static on;
>> gzip_buffers 16 8k;
>> gzip_http_version 1.0;
>> gzip_min_length 0;
>> gzip_vary on;
>> gzip_types text/plain text/css application/x-javascript
>> text/xml application/xml application/xml+rss text/javascript;
>>
>> # Load config files from the /etc/nginx/conf.d directory
>> include /etc/nginx/conf.d/*.conf;
>>
>> }
>>
>> ### /etc/nginx/conf.d/domain.conf ###
>>
>> server {
>> listen 80;
>> server_name domain.com;
>>
>> root /var/www/html;
>>
>> location / {
>> index index.html index.php; ## Allow a static html file to be
>> shown first
>> try_files $uri $uri/ @handler; ## If missing pass the URI to
>> Magento's front handler
>> expires max; ## Assume all files
>> are cachable
>> error_page 404 = @handler;
>> log_not_found off;
>> }
>>
>> location ~ /(.*)/index\.php$ { ## strip index.php from product urls
>> if (!-e $request_filename) { rewrite ^(.*)/index\.php$ $1/
>> permanent; }
>> }
>>
>> location /minify/ { ## Needed for Fooman Speedster
>> rewrite ^/minify/([0-9]+)(/.*\.(js|css))$
>> /lib/minify/m.php?f=$2&d=$1 last;
>> }
>>
>> ## These locations would be hidden by .htaccess normally
>> location /app/ { deny all; }
>> location /includes/ { deny all; }
>> location /lib/ { deny all; }
>> location /lib/minify/ { allow all; } ## Deny is applied
>> after rewrites so must specifically allow minify
>> location /media/downloadable/ { deny all; }
>> location /pkginfo/ { deny all; }
>> location /report/config.xml { deny all; }
>> location /var/ { deny all; }
>>
>> location /var/export/ { ## Allow admins only to view export folder
>> auth_basic "Restricted"; ## Message shown in login window
>> auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
>> }
>>
>> location /. { ## Disable .htaccess and other hidden files
>> return 404;
>> }
>>
>> location @handler { ## Magento uses a common front handler
>> rewrite / /index.php;
>> }
>>
>> location ~ \.php/ { ## Forward paths like /js/index.php/x.js to
>> relevant handler
>> rewrite ^(.*\.php)/ $1 last;
>> }
>>
>> location ~ \.php$ { ## Execute PHP scripts
>> expires off; ## Do not cache dynamic content
>> fastcgi_param HTTPS $fastcgi_https;
>> fastcgi_param SCRIPT_FILENAME
>> $document_root$fastcgi_script_name;
>> fastcgi_param PATH_INFO $fastcgi_script_name;
>> fastcgi_pass 127.0.0.1:9000;
>> fastcgi_index index.php;
>> fastcgi_param MAGE_RUN_CODE base;
>> fastcgi_param MAGE_RUN_TYPE website;
>> include fastcgi_params; ## See
>> /etc/nginx/fastcgi_params
>> }
>>
>> }
>>
>> ### END ###
>>
>> This is not necessarily the most optimal or logical configuration, but
>> it works for me. It could probably be simplified, though you'll also
>> likely want to at least add a server configuration for SSL.
>>
>> Hope that helps! Let me know how it goes for you.
>>
>> Best,
>> Raina
>>
>> On Mon, Aug 9, 2010 at 9:29 PM, pablo platt <pablo.platt@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > Anyone can share a working magento setup?
>> > I've read that nginx outperforms apache but couldn't find a clear
>> > instructions how to setup on ubuntu:
>> > nginx + config file
>> > fcgi + spawn-fcgi + upstart script
>> > php-fpm
>> >
>> > Thanks
>> >
>> > _______________________________________________
>> > nginx mailing list
>> > nginx@nginx.org
>> > http://nginx.org/mailman/listinfo/nginx
>> >
>> >
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://nginx.org/mailman/listinfo/nginx
>>
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

magento setup

pablo platt August 09, 2010 10:32PM

Re: magento setup

Raina Gustafson August 09, 2010 10:50PM

Re: magento setup

Raina Gustafson August 10, 2010 11:42PM

Re: magento setup

pablo platt August 11, 2010 01:46PM

Re: magento setup

pablo platt August 19, 2010 11:38PM

Re: magento setup

Nicholas Sherlock August 20, 2010 02:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 299
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready