GithubHelp home page GithubHelp logo

sakirsensoy / apache-to-nginx Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 4.0 152 KB

A simple script for Apache configuration file convert to Ngix conf.

License: MIT License

JavaScript 59.62% Smarty 40.38%

apache-to-nginx's Introduction

apache-to-nginx

A simple script for Apache configuration file convert to Ngix conf.

Installation

$ [sudo] npm install -g apache-to-nginx

Usage

Parameters

$ apache-to-nginx <apache_virtual_host.conf> <nginx_conf_files_location> <template.tpl>

Examples

# generate configuration file with default template (PHP-FPM)
$ apache-to-nginx /etc/apache2/sites-available/example.com.conf /etc/nginx/site-available

# generate configuration file with custom template
$ apache-to-nginx /etc/apache2/sites-available/example.com.conf /etc/nginx/site-available /path/to/custom.tpl

Configuration file template customization

Default configuration template:

server {
    listen {listen};
    server_name {serverName};
    root {directory};

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log /var/log/nginx/{serverName}-access.log;
    error_log  /var/log/nginx/{serverName}-error.log error;

    error_page 404 /index.php;

    sendfile off;

    location ~ \.php$ {
        try_files  $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_read_timeout 120;
        fastcgi_send_timeout 120;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.