Jelajahi Sumber

Add config files for nginx & apache with php-fpm

rajven 3 tahun lalu
induk
melakukan
bedc962009
4 mengubah file dengan 95 tambahan dan 0 penghapusan
  1. 20 0
      docs/apache/000-default.conf
  2. 23 0
      docs/apache/php-fpm/readme.txt
  3. 37 0
      docs/nginx/Eye
  4. 15 0
      docs/nginx/fpm/www.conf

+ 20 - 0
docs/apache/000-default.conf

@@ -0,0 +1,20 @@
+<VirtualHost *:80>
+
+	#ServerName www.example.com
+
+	ServerAdmin webmaster@localhost
+
+	DocumentRoot /opt/Eye/html
+
+	<Directory /opt/Eye/html/>
+	    Options Indexes FollowSymLinks
+	    AllowOverride None
+	    Require all granted
+	</Directory>
+
+	ErrorLog ${APACHE_LOG_DIR}/error.log
+	CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+</VirtualHost>
+
+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

+ 23 - 0
docs/apache/php-fpm/readme.txt

@@ -0,0 +1,23 @@
+a2dismod php7.4
+a2dismod mpm_prefork
+a2enmod mpm_event
+
+apt install php-fpm libapache2-mod-fcgid
+
+a2enconf php7.4-fpm
+a2enmod proxy
+
+apachectl configtest
+
+systemctl enable php7.4-fpm.service
+systemctl restart php7.4-fpm.service
+
+systemctl restart apache2
+
+#test
+# apachectl -M | grep 'mpm'
+ mpm_event_module (shared)
+
+# apachectl -M | grep 'proxy'
+ proxy_module (shared)
+ proxy_fcgi_module (shared)

+ 37 - 0
docs/nginx/Eye

@@ -0,0 +1,37 @@
+server {
+	listen 80 default_server;
+
+	root /opt/Eye/html;
+
+	index index.html index.php;
+
+	server_name _;
+
+	location / {
+		# First attempt to serve request as file, then
+		# as directory, then fall back to displaying a 404.
+		try_files $uri $uri/ =404;
+	}
+
+	error_page 404 302 301  /public/blocked.php;
+
+	location ~ \.php$ {
+		include snippets/fastcgi-php.conf;
+		fastcgi_pass unix:/run/php/php7.4-fpm.sock;
+	#	fastcgi_pass 127.0.0.1:9000;
+	}
+
+	location ~ /cfg {
+		deny all;
+	}
+
+	location ~ /inc {
+		deny all;
+	}
+
+	# deny access to .htaccess files, if Apache's document root
+	# concurs with nginx's one
+	location ~ /\.ht {
+		deny all;
+	}
+}

+ 15 - 0
docs/nginx/fpm/www.conf

@@ -0,0 +1,15 @@
+[www]
+user = www-data
+group = www-data
+listen = /run/php/php7.4-fpm.sock
+listen.owner = www-data
+listen.group = www-data
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+
+php_admin_flag[display_errors] = off
+php_admin_flag[log_errors] = on
+php_admin_value[memory_limit] = 64M