Install web2py nginx




















X, Check if user has root privileges. Get Web2py Admin Password. Create user Web2py. Prepare folders for uwsgi. Author: James Oakley. Provides: uwsgi. Should-Stop: ypbind smtp. Default-Start: 3 5. Default-Stop: 0 1 2 6. In order to complete this guide, you should have a fresh CentOS 7 server instance with a non-root user with sudo privileges configured.

You can learn how to set this up by running through our initial server setup guide. We will be downloading the web2py framework and testing it to make sure the default application environment functions correctly. Afterwards, we will download and install the uWSGI application container to serve as an interface between requests and the web2py Python code.

We will set up Nginx in front of this so that it can handle client connections and proxy requests to uWSGI. We will configure each of our components to start at boot to minimize the need for administrative intervention. Our first step will be to download the actual web2py framework.

This is maintained in a git repository on GitHub, so the best way to download it is with git itself. In our example, we are using the name myapp for simplicity.

We need to add the --recursive flag because the database abstraction layer is handled as its own git submodule:. The web2py framework will be downloaded to a directory called myapp within your home directory. The administrative interface must be secured by SSL, so we can make a simple self-signed certificate to test this out. Create the server key and certificate by typing:. You will have to fill out some information for the certificate you are generating. When you are finished, an SSL key and certificate should be in your application directory.

These will be called myapp. With that complete, we can start up the web2py web interface to test it out. To do this, we can type:. Make sure you use https instead of http in the above address. You will be warned that your browser does not recognize the SSL certificate:. This is expected since we have signed our own certificate. You will see the web2py interface:. This gives you access to the actual code that is running your applications, allowing you to edit and tweak the files from within the interface itself.

We have tested our application and demonstrated that it can be accessed on the web when the web2py development server is running. Now that we have the web2py application operational, we can configure uWSGI. We will also need a compiler to build the actual binary. The web2py framework includes a file designed to provide this interface within its handlers directory. To use the file, we need to move it out of the directory and into the main project directory:.

This should start up the application again on port You can test this in your browser again using the http protocol. You will be unable to test the admin interface because web2py disables this when encryption is not available.

In the configuration file, we need to start with a [uwsgi] header under which all of our configuration directives will be placed. After the header, we will indicate the directory path of our application and tell it the module to execute.

This will be the same information we used on the command line earlier. You do not need to modify the module line:. Next, we need to specify that we want uWSGI to operate in master mode. We want to spawn five worker processes:.

Next, we need to specify how we want uWSGI to get connections. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.

Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.



0コメント

  • 1000 / 1000