---
title: 'Konfigurera utvecklingsmiljön'
url: 'https://tucek.me/sv/tech/setting-upp-development-environment'
markdown: 'https://tucek.me/sv/tech/setting-upp-development-environment.md'
lang: sv
date: '2026-08-30'
description: 'Webbserver sudo apt install acl wget curl vim git tree php php-common libapache2-mod-php \ php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring \ php-curl php-xml php-pear php-bcmath php-cgi zip unzip certbot \ python3-certbot-apache mariadb-server sudo a2enmod rewrite sudo a2enm…'
---

# Konfigurera utvecklingsmiljön

## Webbserver

```command
sudo apt install acl wget curl vim git tree php php-common libapache2-mod-php \
php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd  php-mbstring \
php-curl php-xml php-pear php-bcmath php-cgi zip unzip certbot \
python3-certbot-apache mariadb-server
sudo a2enmod rewrite
sudo a2enmod ssl
```

### Apache

`sudo vim /etc/apache2/sites-available/000-default.conf`

```setting
<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/html

  RewriteEngine on

  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

  <Directory /var/www/html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  RewriteCond %{SERVER_NAME} =example.com [OR]
  RewriteCond %{SERVER_NAME} =www.exaple.com
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
```

`sudo vim /etc/apache2/sites-available/default-ssl.conf`

```setting
<IfModule mod_ssl.c>
  <VirtualHost _default_:443>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RewriteEngine on

    <Directory /var/www/html>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
    </Directory>

    SSLEngine on

    SSLCertificateFile  /etc/ssl/certs/snake-oil.crt
    SSLCertificateKeyFile /etc/ssl/private/snake-oil.key

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
        SSLOptions +StdEnvVars
    </Directory>

  </VirtualHost>
</IfModule>
```

### PHP

```command
sudo php -i | grep -i "upload\_max\_filesize\|post\_max\_size\|max\_file\_uploads\|memory\_limit"
```

Ändra värden i `sudo vim /etc/php/7.4/apache2/php.ini` och `sudo vim /etc/php/7.4/cli/php.ini` till:

```setting
max_file_uploads => 20 => 20
post_max_size => 8M => 40M
upload_max_filesize => 2M => 30M
memory_limit=>128=>512
```

Certifikat

```command
openssl genrsa -out pki/private/server.key
openssl req -new -key pki/private/server.key -out pki/reqs/server.req
./easyrsa sign-req server server
```

## **bash**

```command
export OSH="$HOME/.config/oh-my-bash"; bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
```

## Node.js

### Ladda ner och installera

[Nodejs](https://github.com/nodesource/distributions)

```command
sudo su
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &&\
apt-get install -y nodejs
npm install -g npm@9.6.3
npm install --global yarn
```

Spara, stäng och ladda om profilen

```command
. ~/.profile
```

---

## Navigation

- Parent: [Teknik](https://tucek.me/sv/tech.md)
- Previous: [Nextcloud](https://tucek.me/sv/tech/nextcloud.md)
- Next: [Mobiltelefoner](https://tucek.me/sv/tech/mobile-phones.md)
