Question

Configuring nginx

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


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.

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

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

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>