0

previously I was using Apache and I used to put php files under /var/www/. Likewise where should I put my files in nginx server. I am using Ubuntu 12.04.

1
  • 1
    That depends on how you've configured nginx. See /etc/nginx/sites-available. Commented Nov 22, 2013 at 4:01

1 Answer 1

2

That depends on your configuration. You can put your doc root wherever you want. /var/www is often used by default, but not always.

In addition, it depends on how you've configured any handlers for PHP. Nginx doesn't run your PHP, PHP does. (This was the same for Apache... you were likely using an Apache module version of PHP, or CGI.) If you haven't configured this yet, look into PHP-FPM.

Sign up to request clarification or add additional context in comments.

5 Comments

should I always edit config file for a small change, say i want to execute test.php which out puts phpinfo() ? Can't I put the file in some default location which nginx can read ( like /var/www in apache2 OR /xampp/htdocs/ in Xampp-apache)
@ManojKumar Sure you can. You can configure whatever path you want.
No Brad, what I am asking is - if you type localhost in browser, it will display 'Welcome to nginx!'. In which file this is written. I want to edit it to show some other message.
@ManojKumar Please read again. Configure your path accordingly. If you don't know what that path is now, check /etc/nginx/sites-enabled/default
Thanks Brad, I got it - it is /usr/share/nginx/www

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.