ubuntu - Can a server run Nginx for some sites and Apache Nginx Reverse Proxy for others? -
on server ideally i'd serve own static , wordpress sites using cloudflare > varnish > nginx since i'd hosting others sites testing such joomla , wordpress rely on multiple extensions use .htaccess , such, wouldn't able run sites through nginx. i'd run sites on same server cloudflare > varnish > nginx reverse proxy > apache.
the server has 1 ip address , runs ubuntu , php-fpm , mysql. each site have own separate domain name. possible?
server { server_name example.com; location / { # assuming apache on port 81 example proxy_pass http://127.0.0.1:81; # make apache detect host header proxy_set_header host $host; } # if have assets folders, can let nginx serve them directly, # instead of passing them apache location /images { # or /css or /js .. etc try_files $uri =404; } }
note: in case of assets, sites serve assets through rewrites, or handled application self, can pass apache adding in assets location fallback this
location /images { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:81; }
in apache create virtual host
<virtualhost *:81> servername example.com # rest of config if needed </virtualhost>
Comments
Post a Comment