w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can a server run Nginx for some sites and Apache Nginx Reverse Proxy for others?
server {
    server_name example.com;
    location / {
        # assuming apache is on port 81 for example
        # to make apache detect the host header
        proxy_set_header Host $host;

# if you have assets folders, you can let nginx serve them directly,
# instead of passing them to apache

    location /images { # or /css or /js .. etc
        try_files $uri =404;

Note: in the case of assets, sometimes some sites serve assets through rewrites, or even handled by the application it self, you can pass it to apache by adding that in the assets location as a fallback like this

location /images {
    try_files $uri @apache;
location @apache {

In apache you create a virtual host

<VirtualHost *:81>
    ServerName example.com
    # the rest of the config if needed

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.