drupal 8 nginx in ubuntu server installation problem

  • Posted on April 24, 2014
  • shyam541Asked by shyam541

I was able to install nginx, php5 and drupal 8 as well. But the site does not see work as expected.

You can see this url.

And below is nginx config.

server { #listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www/d8;
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to index.html
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules

    location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            deny all;

    # Only for nginx-naxsi : process denied requests
    #location /RequestDenied {
            # For example, return an error code
            #return 418;

    error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/www;

    location @rewrite {
            # Drupal in a subdirectory
            rewrite ^/([^/]*)/(.*)(/?)$ /$1/index.php?q=$2&$args;


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You don’t seem to have it set up correctly to run the php files. There’s a tutorial on how to get Drupal setup with nginx here: <br> <br> <br> <br>You should check it out for all the information, but for starters you should add something like the following in your nginx config. <br> <br><pre> <br> # pass the PHP scripts to FastCGI server <br> location ~ .php$ { <br> # With php5-fpm: <br> fastcgi_pass unix:/var/run/php5-fpm.sock; <br> fastcgi_index index.php; <br> include fastcgi_params; <br> } <br></pre>