mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Some checks failed
Build assets artifact / Build assets artifact (push) Has been cancelled
Docker Image Build / docker (push) Has been cancelled
Docker Image Build (FrankenPHP) / docker (push) Has been cancelled
Static analysis / Static analysis (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, sqlite) (push) Has been cancelled
* Initial plan * Fix spelling and grammar mistakes in documentation Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2.3 KiB
2.3 KiB
| title | layout | parent | nav_order |
|---|---|---|---|
| Nginx | default | Installation | 10 |
Nginx
You can also use nginx as webserver for Part-DB. Setting up Part-DB with Apache is a bit easier, so this is the method shown in the guides. This guide assumes that you already have a working nginx installation with PHP configured.
Setup
- Install composer and yarn as described in the [apache guide]({% link installation/installation_guide-debian.md %}#install-composer).
- Create a folder for Part-DB and install and configure it as described
- Instead of creating the config for apache, add the following snippet to your nginx config:
server {
# Redirect all HTTP requests to HTTPS
listen 80;
# Change this to your domain
server_name parts.example.com;
return 301 https://$host$request_uri;
}
server {
# listen 80;
listen 443 ssl;
# Change this to your domain
server_name parts.example.com;
# /var/www/partdb/ should be the path to the folder where you installed Part-DB
root /var/www/partdb/public;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~ \.php$ {
return 404;
}
# Set Content-Security-Policy for svg files, to block embedded javascript in there
location ~* \.svg$ {
add_header Content-Security-Policy "default-src 'self'; script-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors 'none';";
}
error_log /var/log/nginx/parts.error.log;
access_log /var/log/nginx/parts.access.log;
# SSL parameters
ssl_certificate /var/www/certs/SSL/domain.cert.pem;
ssl_certificate_key /var/www/certs/SSL/private.key.pem;
ssl_trusted_certificate /var/www/certs/SSL/intermediate.cert.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
}
- Restart nginx with
sudo systemctl restart nginxand you should be able to access Part-DB under your configured domain.