SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Install PHP with NGINX

    Hi all.

    Found that howto on reddit - http://stackful.io/blog/phix-n-insta...he-hacker-way/. I was just curious if anyone has had experience running PHP with nginx in the past.

    Thanks.

  2. #2
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    356
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ispconfig3 www.ispconfig.org has tutorials on building servers with NGINX and PHP on various distros, so I imagine a fair number of users of ispconfig are using nginx
    Doug G
    =====
    "If you ain't the lead dog, the view is always the same - Anon

  3. #3
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here you can learn about setting up Nginx over Ubuntu 12.04 with PHP, WordPress-Nginx configuration and more.
    http://rtcamp.com/wordpress-nginx/tutorials/
    However, WordPress-Nginx configuration itself are OS independent for most of the parts.
    Recently bought a new blog. Know how to buy and sell blogs

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    This is the script we are using to get drupal stood up on Ubuntu 1204 behind NGINX with php-fpm

    Install script:
    Code:
    #! bin/sh
    apt-get update -y
    apt-get upgrade -y
    apt-get install mysql-server mysql-client -y
    apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-fpm -y
    apt-get install nginx -y
    mv /etc/nginx/sites-enabled/default /etc/nginx/sites-available
    cp /webapps/conf/drupal /etc/nginx/sites-available
    service nginx restart
    Nginx conf
    Code:
    server {
            server_name domain.tld;
            root /webapps/drupal/site; ## <-- Your only path reference.
     
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
     
            location = /robots.txt {
                    allow all;
                    log_not_found off;
                    access_log off;
            }
     
            # This matters if you use drush
            location = /backup {
                    deny all;
            }
     
            # Very rarely should these ever be accessed outside of your lan
            location ~* \.(txt|log)$ {
            #        allow 192.168.0.0/16;
                    deny all;
            }
     
            location ~ \..*/.*\.php$ {
                    return 403;
            }
     
            location / {
                    # This is cool because no php is touched for static content
                    try_files $uri @rewrite;
            }
     
            location @rewrite {
                    # Some modules enforce no slash (/) at the end of the URL
                    # Else this rewrite block wouldn't be needed (GlobalRedirect)
                    rewrite ^/(.*)$ /index.php?q=$1;
            }
     
            location ~ \.php$ {
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                    include fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_intercept_errors on;
                    fastcgi_pass 127.0.0.1:9000;
            }
     
            # Fighting with ImageCache? This little gem is amazing.
            location ~ ^/sites/.*/files/imagecache/ {
                    try_files $uri @rewrite;
            }
            # Catch image styles for D7 too.
            location ~ ^/sites/.*/files/styles/ {
                    try_files $uri @rewrite;
            }
     
            location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                    expires max;
                    log_not_found off;
            }
    }

  5. #5
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks everyone!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •