6 responses to “How To Setup a NGINX Virtual Host Using a Custom Domain”

  1. voku

    you can speedup (expire) the pictures … with this settings

    location ~* ^.+.(htm|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
    access_log off;
    expires max;
    root /var/www/example.com/html/;

    I also read about adding this… ?!?

    if (-f $request_filename) {
  2. Andreas

    Great guide, however if php-fpm are running through the socket name the php-block should be something like this:

    location ~ \.php$
    include /etc/nginx/fastcgi.conf;
    fastcgi_pass unix:/var/run/php5-fpm.sock;

  3. AgriCulture

    Nice and simple tut !
    I found it helpful for Nginx beginner, look forward for some security configs too,


  4. Tim

    First of all really nice tutorial i searched about 3 hours and now found this and its running thx 🙂
    but i ve got the problem, i cant get access on subfolder.
    How to solve this?

  5. omarxp studio

    thanks for sharing, i’m looking for tutorial like this. very helpfull

  6. Lee McIntosh

    How would one go about adding a subdomain to this?