IagoSousa
By:
IagoSousa

Hosting a wiki and redmine on same droplet.

April 25, 2017 280 views
Nginx Ubuntu

I've already looked at other peoples' questions about the same subject and already tried their solutions. I'm in more need of a guide than a absolute answer.

I have installed Ubuntu 14.04 Redmine on my droplet (the installation that DO offers) now my project manager also wants my domain to have a wiki.

We have a domain that is hackerspaceqx.com when you open it will bring the redmine page. What i want to do is the main site opens up a wiki and you have to type hackerspaceqx.com/redmine to access the redmine part of the project. How can this be done?

PS: I don't have experience with Nginx

3 Answers

@IagoSousa

It's definitely possible to do this, though how you'd go about it depends on the Wiki software that you choose to use.

Your NGINX server block should be located here:

/etc/nginx/sites-available/default

If that file doesn't exist, you can run:

ls /etc/nginx/sites-available/

...to see what file(s) are there, and then find the one that is associated with your site.

...

The file will start with server { and end with a }. Within this file, you'll see a few variables such as:

root
server_name
location ....

etc. That's the configuration that tells NGINX how to handle requests for your site in some manor.

Moving the Redmine instance to /redmine and setting up the Wiki could be as easy as modifying the current location block and adding another, or it could require installing more software. It really depends on what you want to use for the Wiki software.

If you can copy and paste the contents of your current NGINX server block file to a code block as a reply, I can take a look at it for you.

Hello,

You can make NGINX listen to specific directories and domains. With the use of VHOSTS you can basically run an unlimited amount of websites on your webserver as long as you have resources.

To do what you want, I wouldn't make it to difficult; you can just edit your default nginx configuration file (I would rename it just for developer knowledge) and then make a directory for the /redmine

So; inside your /var/www/html make a directory called redmine and put all your redmine files in there. Now you can put your main website inside the "root" directory /var/www/html. Your directory will then look like this:

  • /var/www/html --> your wiki files
  • /var/www/html/redmine --> your redmine files

Now you can just edit your NGINX configuration to serve both webdirectories. First rename your default configuration:

sudo rm /etc/nginx/sites-enabled/default
sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/hackerspaceqx.com
sudo ln -s /etc/nginx/sites-available/hackerspaceqx.com /etc/nginx/sites-enabled/hackerspaceqx.com

This doesn't really matter, the name is just for developers to know what kind of configuration it is.
Now edit the configuration file and restart the nginx service:

sudo nano /etc/nginx/site-available/hackerspaceqx.com

with the following content:
(may be a bit different than what you have now, if you use PHP you need to have the PHP socket in there as well)

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;

        server_name hackerspaceqx.com www.hackerspaceqx.com;

        location / {
                try_files $uri $uri/ =404;
        }

        location /redmine {
                try_files $uri $uri/ =404;
        }
}

Now restart nginx

sudo service nginx restart

I hope this will help you out, if you have got any more questions don't hesistate to ask me!

  • When i installed the ubuntu with redmine app the iamge comes with a different path than the default, it also comes with a file names "redmine" at sites-available and sites-enabled. I understood what you said but i don't know where are the files to move the redmine folder.
    this is the redmine file:

    server {
            listen 80;
            server_name 107.170.33.111 redmine-hsqx hackerspaceqx.com hackerspaceqx.com;
    
            root /srv/redmine/public;
            passenger_enabled on;
    
            client_max_body_size 10m;
    }
    

    and this is the default file:

      GNU nano 2.2.6                                                                                                     File: default                                                                                                                                                                                                                
    
    ##
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # http://wiki.nginx.org/Pitfalls
    # http://wiki.nginx.org/QuickStart
    # http://wiki.nginx.org/Configuration
    #
    # Generally, you will want to move this file somewhere, and start with a clean
    # file but keep this around for reference. Or just disable in sites-enabled.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##
    
    # Default server configuration
    #
    server {
            listen 80 default_server;
            listen [::]:80 default_server;
    
            # SSL configuration
            #
            # listen 443 ssl default_server;
            # listen [::]:443 ssl default_server;
            #
            # Self signed certs generated by the ssl-cert package
            # Don't use them in a production server!
            #
            # include snippets/snakeoil.conf;
    
            root /usr/share/nginx/html;
    
            # Add index.php to the list if you are using PHP
            index index.html index.htm index.nginx-debian.html;
    
            server_name _;
    
            location / {
                    # First attempt to serve request as file, then
                    # as directory, then fall back to displaying a 404.
                    try_files $uri $uri/ =404;
            }
    
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            #location ~ \.php$ {
            #       include snippets/fastcgi-php.conf;
            #
            #       # With php5-cgi alone:
            #       fastcgi_pass 127.0.0.1:9000;
            #       # With php5-fpm:
            #       fastcgi_pass unix:/var/run/php5-fpm.sock;
            #}
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #       deny all;
            #}
    }
    
    
    # Virtual Host configuration for example.com
    #
    # You can move that to a different file under sites-available/ and symlink that
    # to sites-enabled/ to enable it.
    #
    #server {
    #       listen 80;
    #       listen [::]:80;
    #
    #       server_name example.com;
    #
    #       root /var/www/example.com;
    #       index index.html;
    #
    #       location / {
    #               try_files $uri $uri/ =404;
    #       }
    #}
    
    
    

I'ma try these when i get back from university after lunch, for now that's my server block code

server {
        listen 80;
        server_name 107.170.33.111 redmine-hsqx hackerspaceqx.com hackerspaceqx.com;

        root /srv/redmine/public;
        passenger_enabled on;

        client_max_body_size 10m;
}


also i might try to install the wikia wiki which is open source

Have another answer? Share your knowledge.