Report this

What is the reason for this report?

Configuring nginx

Posted on March 27, 2013

Can I copy and paste the info into this file as it or change the values individually.

Can someone take me through exactly what I do here:

Add index.php to the index line.

Change the server_name from local host to your domain name or IP address (replace the example.com in the configuration)

Change the correct lines in “location ~ .php$ {“ section



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!

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.

It depends on what you have processing your PHP code in our case we have a writeup on getting a LEMP stack up and running using php5-fpm to process PHP. <br> <br>You can find the full writeup here: <br>https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04 <br> <br>The nginx config file would be setup as follows in that case: <br> <br>server { <br> listen 80; <br>
<br> <br> root /usr/share/nginx/www; <br> index index.php index.html index.htm; <br> <br> server_name example.com; <br> <br> location / { <br> try_files $uri $uri/ /index.html; <br> } <br> <br> error_page 404 /404.html; <br> <br> error_page 500 502 503 504 /50x.html; <br> location = /50x.html { <br> root /usr/share/nginx/www; <br> } <br> <br> # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 <br> location ~ .php$ { <br> #fastcgi_pass 127.0.0.1:9000; <br> # With php5-fpm: <br> fastcgi_pass unix:/var/run/php5-fpm.sock; <br> fastcgi_index index.php; <br> include fastcgi_params; <br>
<br> } <br> <br>} <br>

I got this message when I restarted nginx: configuration file /etc/nginx/nginx.conf test failed <br>

This was the message:Restarting nginx: nginx: [emerg] unexpected end of file, expecting “}” in /etc/n ginx/sites-enabled/default:121 <br>

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.