procedures:osticket

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
procedures:osticket [2026/07/03 09:27] mattia.stalioprocedures:osticket [2026/07/03 10:54] (current) mattia.stalio
Line 1: Line 1:
-====== OsTicket Install ======+====== OsTicket Install/Migration ======
 This part is for installing the v1.10 of the osTicket software which is the one that is live at the moment of the writing of this Wiki. This part is for installing the v1.10 of the osTicket software which is the one that is live at the moment of the writing of this Wiki.
  
Line 14: Line 14:
 ===Apche and MariaDB=== ===Apche and MariaDB===
 <code>sudo apt install -y apache2 mariadb-server</code> <code>sudo apt install -y apache2 mariadb-server</code>
 +Now do the mariadb secure installation
 +<code>mariadb-secure-installation</code>
 +And to finish the mariadb config add these lines in /etc/mysql/my.cnf to enable the remote access
 +<code>[mysqld]
 +bind-address=0.0.0.0</code>
 ===Php5.6 and necessary extension=== ===Php5.6 and necessary extension===
 <code>sudo apt install -y php5.6 php5.6-cli php5.6-mysql php5.6-fpm php5.6-xml php5.6-mbstring php5.6-gd php5.6-imap php5.6-json php5.6-apcu php5.6-intl php5.6-mcrypt libapache2-mod-php5.6</code> <code>sudo apt install -y php5.6 php5.6-cli php5.6-mysql php5.6-fpm php5.6-xml php5.6-mbstring php5.6-gd php5.6-imap php5.6-json php5.6-apcu php5.6-intl php5.6-mcrypt libapache2-mod-php5.6</code>
Line 27: Line 32:
 CREATE USER 'osticket_user'@'localhost' IDENTIFIED BY 'password_of_ur_choice'; CREATE USER 'osticket_user'@'localhost' IDENTIFIED BY 'password_of_ur_choice';
 GRANT ALL PRIVILEGES ON osticket_db.* TO 'osticket_user'@'localhost'; GRANT ALL PRIVILEGES ON osticket_db.* TO 'osticket_user'@'localhost';
 +CREATE USER 'root'@'%' IDENTIFIED BY 'password_of_ur_choice'; (to have a user with the remote access)
 +GRANT ALL PRIVILEGES ON osticket_db.* TO 'root'@'%';
 FLUSH PRIVILEGES; FLUSH PRIVILEGES;
 EXIT;</code> EXIT;</code>
Line 96: Line 103:
 ===Make sure the config file is only readble=== ===Make sure the config file is only readble===
 <code>sudo chmod 0644 /var/www/html/osticket/include/ost-config.php</code> <code>sudo chmod 0644 /var/www/html/osticket/include/ost-config.php</code>
 +
 +
 +======Nginx migration======
 +Now the migration from apache2 to nginx
 +====1.Nginx Install====
 +<code>sudo apt update
 +sudo apt install nginx -y</code>
 +====2.Stop Apache2====
 +<code>sudo systemctl stop apache2
 +sudo systemctl disable apache2</code>
 +====3.Configure PHP-FPM for nginx====
 +<code>sudo systemctl enable --now phpx.x-fpm</code>
 +====4.Create Nginx config file====
 +===Remove the nginx default link===
 +<code>sudo rm /etc/nginx/sites-enabled/default</code>
 +===Create a new config file===
 +<code>sudo vim /etc/nginx/sites-available/osticket</code>
 +<code>server {
 +    listen 80;
 +    server_name your_URL_or_IP;
 +    root /var/www/html;
 +    index index.php index.html index.htm;
 +
 +    access_log /var/log/nginx/osticket_access.log;
 +    error_log /var/log/nginx/osticket_error.log;
 +
 +    location ~ ^/osticket/(include|setup|pages|plugins)/ {
 +        deny all;
 +        return 403;
 +    }
 +
 +    location /osticket/ {
 +        try_files $uri $uri/ /osticket/index.php?$query_string;
 +    }
 +    location ~ ^/osticket/(api|apps|include/plugins)/ {
 +        try_files $uri $uri/ @osticket-api;
 +    }
 +
 +    location @osticket-api {
 +        rewrite ^/osticket/api/(.*)$ /osticket/api/http.php/$1 last;
 +        rewrite ^/osticket/apps/(.*)$ /osticket/apps/dispatcher.php/$1 last;
 +    }
 +
 +    location ~ \.php$ {
 +        include snippets/fastcgi-php.conf;
 +        fastcgi_pass unix:/var/run/php/phpx.x-fpm.sock;
 +        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 +        include fastcgi_params;
 +
 +        fastcgi_read_timeout 300;
 +    }
 +
 +    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
 +        expires 30d;
 +    }
 +
 +    location ~ /\. {
 +        deny all;
 +    }
 +}</code>
 +====5.Activate the website and Nginx====
 +===Enable the website===
 +<code>sudo ln -s /etc/nginx/sites-available/osticket /etc/nginx/sites-enabled/</code>
 +===Test the config and start Nginx===
 +<code>sudo nginx -t</code>
 +If the result is positive then start nginx
 +<code>sudo systemctl enable --now nginx</code>
 +====6.Final permissions checks====
 +<code>sudo chown -R www-data:www-data /var/www/html/osticket/
 +sudo chmod -R 755 /var/www/html/osticket/</code>
 +====7.Https certificate====
 +===Install certbot===
 +<code>apt install -y python3-certbot python3-certbot-nginx</code>
 +===Use certbot===
 +After you run this command follow the instructions
 +<code>sudo certbot certonly --nginx</code>
 +===Update the Nginx configuration file===
 +<file>server {
 +    server_name your_URL_or_IP;
 +
 +    root /var/www/html;
 +    index index.php index.html index.htm;
 +
 +    access_log /var/log/nginx/osticket_access.log;
 +    error_log /var/log/nginx/osticket_error.log;
 +
 +    location ~ ^/osticket/(include|setup|pages|plugins)/ {
 +        deny all;
 +        return 403;
 +    }
 +
 +    location /osticket/ {
 +        try_files $uri $uri/ /osticket/index.php?$query_string;
 +    }
 +    location ~ ^/osticket/(api|apps|include/plugins)/ {
 +        try_files $uri $uri/ @osticket-api;
 +    }
 +
 +    location @osticket-api {
 +        rewrite ^/osticket/api/(.*)$ /osticket/api/http.php/$1 last;
 +        rewrite ^/osticket/apps/(.*)$ /osticket/apps/dispatcher.php/$1 last;
 +    }
 +
 +    location ~ \.php$ {
 +        include snippets/fastcgi-php.conf;
 +        fastcgi_pass unix:/var/run/php/phpx.x-fpm.sock;
 +        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 +        include fastcgi_params;
 +
 +        fastcgi_read_timeout 300;
 +    }
 +
 +    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
 +        expires 30d;
 +    }
 +
 +    location ~ /\. {
 +        deny all;
 +    }
 +
 +    listen 443 ssl; # managed by Certbot
 +    ssl_certificate /etc/letsencrypt/live/your_URL/fullchain.pem; # managed by Certbot
 +    ssl_certificate_key /etc/letsencrypt/live/your_URL/privkey.pem; # managed by Certbot
 +    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
 +    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
 +
 +}
 +server {
 +    #if ($host = your_URL) {
 +    #    return 301 https://$host$request_uri;
 +    #} # managed by Certbot
 +
 +
 +    listen 80;
 +    server_name your_URL your_IP;
 +    return 301 http://$host$request_uri;
 +}</file>
 +Restart nginx
 +<code>sudo systemctl restart nginx</code>
  • procedures/osticket.txt
  • Last modified: 2026/07/03 10:54
  • by mattia.stalio