Drupal 8 Configuration for Nginx Server Blocks, Ubuntu 14.04

Updated: 21 February, 2023 seen 2,019

After a long period of doubts should I start testing and developing with Drupal 8, which stable version is not yet released, yesterday I decided to give a try for a Drupal 8 beta release.

I bought a new Linode VPS, quickly deployed there Ubuntu 14.04, and installed Nginx as a web server. I did it because my current server is PHP 5.2, and Drupal 8 is asking for at least PHP 5.3. So  - not to mess up with my existing server configuration, a new Linode seemed the best option. 

All went pretty smoothly, I had some problems configuring Nginx virtual server blocks, but after a couple of hours of investigation all went right (I forget to do the server restart a few times, to apply new changes).

Anyway, when the virtual server was configured, and DNS pointed, I quickly installed Drupal 8 on one of the sub-domains (I'm looking to do a Drupal 7 upgrade to Drupal 8, for my existing blog - the one you are reading right now)

Unfortunately, my Drupal 8 website didn't loaded, because of incorrect Virtual Server block settings (what works for Drupal 7, seems doesn't works for Drupal 8). Luckily I found a working solution on a Drupal website:

Nginx server blocks for Drupal 8

server {
        listen   80; ## listen for ipv4; this line is default and implied
        #listen   [::]:80 default ipv6only=on; ## listen for ipv6
       
        # This is the full path to your index file
        root /var/www/www.example.com/public_html;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        # This will be your domain name
        server_name example.com;

  location / {
                index index.php;
                # This is cool because no php is touched for static content
                try_files $uri $uri/ @rewrite;
                expires max;
              }

  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;
              }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
   location ~ .php$ {
                #fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                }
}

Now it worked great, My Drupal 8 was up and running.

As a Drupal developer based in Tbilisi, I have the skills, expertise, and experience to help you build high-quality websites and web applications using Drupal. With my deep understanding of Drupal's architecture, I can help you leverage Drupal's capabilities to build scalable, secure, and highly performant web solutions that meet your unique needs.

When you hire me for your Drupal development needs, you can expect a highly collaborative and transparent process. I take the time to understand your business requirements, technical specifications, and design preferences, and work closely with you to deliver a custom solution that meets your specific needs. I am committed to delivering projects on time, on budget, and to the highest standards of quality.

My portfolio of work includes a range of projects, from small business websites to large-scale web applications. I have experience working with clients in a variety of industries, and I am dedicated to providing a personalized approach to each project. Whether you need a simple brochure website, an e-commerce platform, or a complex web application, I have the skills and expertise needed to help you achieve your goals.

In addition to my Drupal development skills, I have experience with other web development technologies and frameworks, including HTML, CSS, JavaScript, and PHP. This allows me to take a comprehensive approach to web development and ensure that all aspects of your website or web application are built to the highest standards. So if you're looking for a Drupal developer in Tbilisi, look no further than me.

Disqus