Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- apt update
- yes | apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring
- #
- curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
- | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
- #
- echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
- http://nginx.org/packages/debian `lsb_release -cs` nginx" \
- | tee /etc/apt/sources.list.d/nginx.list
- #
- echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
- | tee /etc/apt/preferences.d/99nginx
- #
- apt update
- apt install nginx
- mkdir /var/www
- #
- #
- #
- (cat<<-EOF
- server {
- listen 80 default_server;
- listen [::]:80 default_server;
- server_name _;
- index index.php;
- root /var/www;
- location / {
- root /var/www;
- index index.php;
- }
- error_page 404 /404.php;
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
- location ~ \.php\$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)\$;
- try_files \$fastcgi_script_name = 404;
- set \$path_info \$fastcgi_path_info;
- fastcgi_param PATH_INFO \$path_info;
- fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
- fastcgi_param QUERY_STRING \$query_string;
- fastcgi_param REQUEST_METHOD \$request_method;
- fastcgi_param CONTENT_TYPE \$content_type;
- fastcgi_param CONTENT_LENGTH \$content_length;
- fastcgi_param SCRIPT_NAME \$fastcgi_script_name;
- fastcgi_param REQUEST_URI \$request_uri;
- fastcgi_param DOCUMENT_URI \$document_uri;
- fastcgi_param DOCUMENT_ROOT \$document_root;
- fastcgi_param SERVER_PROTOCOL \$server_protocol;
- fastcgi_param REQUEST_SCHEME \$scheme;
- fastcgi_param HTTPS \$https if_not_empty;
- fastcgi_param GATEWAY_INTERFACE CGI/1.1;
- fastcgi_param SERVER_SOFTWARE nginx/\$nginx_version;
- fastcgi_param REMOTE_ADDR \$remote_addr;
- fastcgi_param REMOTE_PORT \$remote_port;
- fastcgi_param SERVER_ADDR \$server_addr;
- fastcgi_param SERVER_PORT \$server_port;
- fastcgi_param SERVER_NAME \$server_name;
- fastcgi_param REDIRECT_STATUS 200;
- fastcgi_pass unix:/run/php/php8.1-fpm.sock;
- fastcgi_index index.php;
- fastcgi_buffers 8 16k;
- fastcgi_buffer_size 32k;
- }
- }
- EOF
- )>/etc/nginx/conf.d/default.conf
- #
- #
- #
- (cat<<-EOF
- user www-data;
- worker_processes auto;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- access_log off;
- sendfile on;
- keepalive_timeout 65;
- include /etc/nginx/conf.d/*.conf;
- }
- EOF
- )>/etc/nginx/nginx.conf
- #
- #
- #
- apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
- echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list
- curl https://packages.sury.org/php/apt.gpg | apt-key add -
- apt update
- yes | apt install php8.1-{fpm,bz2,curl,intl,xml,cli,mbstring,sqlite3,opcache}
- systemctl enable php8.1-fpm
- service nginx restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement