Skip to content

Instantly share code, notes, and snippets.

@SalahAdDin
Last active October 2, 2023 16:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SalahAdDin/3a5534abdbf49fbc65ab to your computer and use it in GitHub Desktop.
Save SalahAdDin/3a5534abdbf49fbc65ab to your computer and use it in GitHub Desktop.
Take care so much, this is Arch Linux configuration, not other. See the arch phppgadmin wiki for know where are fpm.socket, it's very important! Really, really, really importante create the log files.
#user html;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
access_log /srv/http/www/logs/nginx/access.log;
error_log /srv/http/www/logs/nginx/error.log;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
root /srv/http;
include fastcgi.conf;
}
# PHPpgAdmin
location /phppgadmin {
root /srv/http;
index index.php index.html index.htm;
location ~ ^/phppgadmin/(.+\.php)$ {
try_files $uri =404;
root /srv/http;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phppgadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /srv/http;
}
}
location /phpPGAdmin {
rewrite ^/* /phppgadmin last;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
@SalahAdDin
Copy link
Author

Do this for configure it:
sudo ln -s /usr/share/webapps/phppgadmin /srv/http/phppgadmin
sudo mkdir -p /srv/http/www/logs/nginx/
sudo touch /srv/http/www/logs/nginx/access.log
sudo touch /srv/http/www/logs/nginx/error.log
sudo gedit /etc/nginx/nginx.conf
sudo systemctl enable nginx
sudo systemctl enable php-fpm
sudo systemctl restart nginx
sudo systemctl restart php-fpm
sudo -i -u postgres
initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'
exit
sudo systemctl start postgresql
sudo systemctl enable postgresql

If you need more .information please see:
https://wiki.archlinux.org/index.php/PhpPgAdmin
https://wiki.archlinux.org/index.php/PostgreSQL
https://www.digitalocean.com/community/tutorials/how-to-install-lemp-nginx-mysql-php-stack-on-arch-linux
https://gist.github.com/maciejkowalski/5841435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment