Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Convert Apache Config To NGINX

Tags:

nginx

apache

I am moving from an Apache to an NGINX environment and need to convert the following virtual server configuration to NGINX.

<VirtualHost *:80>
    DocumentRoot /var/www/myproject/web
    ServerName myproject.dev
    ServerAlias myproject.dev

    <Directory /var/www/myproject/web>
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>
</VirtualHost>

What would be the "exact translation" of this to NGINX?

like image 358
Peter Avatar asked Jun 10 '14 07:06

Peter


People also ask

What is .htaccess equivalent for nginx?

Since Nginx does not have an equivalent to the . htaccess file (i.e. no directory level configuration files), you need to update the main configuration and reload nginx for any changes to take effect.

Which config file does nginx use?

By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .


1 Answers

server {
    listen 80;
    server_name myproject.dev;
    root /var/www/myproject/web;
}

Start from here http://wiki.nginx.org/Configuration.

like image 136
Alexey Ten Avatar answered Sep 21 '22 00:09

Alexey Ten