Cannot create nginx virtual host

Hi,

I follow to use nginx for virtualmin. However when creating the virtual host, there are errors:

Creating Nginx virtual host ..
.. Nginx website failed! : virtualmin-nginx::feature_setup failed : Failed to open /etc/nginx/sites-available for writing : No such file or directory at /usr/share/webmin/web-lib-funcs.pl line 1397.

Setting up scheduled Webalizer reporting ..
.. no logging directive found in webserver configuration!

Setting up log file rotation ..
.. no logging directive found in webserver configuration!

Creating MySQL login ..
.. done

Creating MySQL database jplayvn ..
.. done

Setting up spam filtering ..
.. Spam filtering failed! : Failed to open /etc/nginx/sites-available for writing : No such file or directory at /usr/share/webmin/web-lib-funcs.pl line 1397.

Setting up virus filtering ..
.. Virus filtering failed! : Failed to open /etc/nginx/sites-available for writing : No such file or directory at /usr/share/webmin/web-lib-funcs.pl line 1397.

Creating SSL certificate and private key ..
.. done

Adding SSL to Nginx virtual host ..
.. Nginx SSL website failed! : virtualmin-nginx-ssl::feature_setup failed : Failed to open /etc/nginx/sites-available for writing : No such file or directory at /usr/share/webmin/web-lib-funcs.pl line 1397.

Please help me to solve this.
Is there any way to solve this without re-create the host? I already copy some data to the host directory.

Thanks, Giang Anh

Status: 
Active

Comments

Does the directory /etc/nginx/sites-available exist on your system?

No I don't have it. Do I need to create new one?

I created it. Then there is another issue when creating the host: https://goo.gl/Kdk1tk

Applying Nginx configuration ..
.. restart failed :

That's not a very useful message, is it :-(

How did you install Nginx exactly? And which operating system and version are you running there?

Ok, that explains it - the default Virtualmin configs for Nginx assume you are installing from a standard Debian package. You may need to go to Webmin -> Servers -> Nginx Webserver -> Module Config and adjust some of the paths and the command to stop/start the server.

I already config it before: https://goo.gl/sxe8SG

Full path to Nginx config file: /usr/local/nginx/conf/nginx.conf
File or directory for new virtual hosts: /etc/nginx/sites-available
Directory for links to new virtual host files: /etc/nginx/sites-enabled
Full path to Nginx command: /usr/local/nginx/sbin/nginx
Command to start Nginx: /usr/local/nginx/sbin/nginx
Command to stop Nginx: /usr/local/nginx/sbin/nginx -s stop

Is it correct?

Thanks, Giang Anh

When installing Nginx using a typical Ubuntu/Debian .deb package, Webmin is able to use an init script to start and stop the service.

In that case, it uses "service nginx start" and "service nginx stop".

We're not familiar with the process of manually installing it though.

The exact commands would depend on your exact setup.

What you would need to do is come up with a command line for starting and stopping Nginx for your particular installation, and add that into the Webmin module config.

You would want to test it on the command line first... just make sure when you run the command to start and stop Nginx, that you can see the process launching, and exiting, at the appropriate times.