Skip to content

Instantly share code, notes, and snippets.

@mabutler
Last active December 24, 2018 03:53
Show Gist options
  • Save mabutler/dceefad79f8d8aa6e524e285168c746d to your computer and use it in GitHub Desktop.
Save mabutler/dceefad79f8d8aa6e524e285168c746d to your computer and use it in GitHub Desktop.
Install webserver centos (postgres)
server {
listen 80;
listen 443 ssl;
server_name localhost;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php;
}
#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 /usr/share/nginx/html/;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
#!/bin/bash
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# ntp
yum install ntp
#replace servers with time.nist.gov
systemctl enable ntpd
systemctl start ntpd
# postgres
rpm -Uvh https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
yum install postgresql11-server
sudo -upostgres /usr/pgsql-11/bin/initdb --pgdata=/var/lib/pgsql/11/data
systemctl start postgresql-11
systemctl enable postgresql-11
# nginx
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx
systemctl start nginx
systemctl enable nginx
# enable fastcgi /etc/nginx/conf.d/default.conf
# add index.php to index list
# php
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php73
yum install php-cli php-fpm php-pgsql php-mbstring php-curl php-xml php-bcmath php-json
sed -i "s@group = apache@group = nginx@g" /etc/php-fpm.d/www.conf
sed -i "s@user = apache@user = nginx@g" /etc/php-fpm.d/www.conf
systemctl start php-fpm
systemctl enable php-fpm
# app requirements
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/nginx/html/storage(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/nginx/html/bootstrap/cache(/.*)?"
restorecon -Rv /usr/share/nginx/html
semanage boolean -m httpd_can_network_connect_db --on
su - postgres
createuser --pwprompt $appname
yum install git
yum install composer
sudo -unginx git clone $appRepo $serverRoot
cd $serverRoot
sudo -unginx composer install
sudo -unginx ./artisan migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment