简体   繁体   中英

How to change NGINX install location Ubuntu 14.04

My aim is to change directory of NGINX installation to run as a web server. Motive - custom compiled NGINX, with functions which doesn't come with standard.

I've compiled NGINX from source and as was suggested on this page , all configuration was pointed in the new location /usr/local/nginx when compiled. Default installation is at /usr/share/nginx.

After starting the service, NGINX still runs on the default installation.

I've tried to load nginx with new configuration nginx -c /usr/local/nginx/nginx.conf which breaks everything, returning error 404 for index.html.

Multiple attempts at searching, only shows up with changing site directory.

Is there a solid solution to specify from where NGINX loads?

Edit:

As suggested by John Ankanna below, the following fixed it:

  1. sudo mv /usr/share/nginx /usr/share/nginx.bkp - just renaming the directory to recover current setup.

  2. sudo ln -s /usr/local/nginx /usr/share/nginx - create symlink in place of original.

Debian/Ubuntu use a standard directory hierarchy. The command man hier will describe this for you. It is common for packages to create symlinks to place files in the correct place when the program expects them elsewhere.

Try Creating Symlink

sudo ln -s /usr/share/nginx /usr/local/nginx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM