【Nginx】Nginx虛擬vhost配置檔案
Nginx可以採用vhost虛擬配置檔案配置多個conf,多個域名多個配置檔案方便管理
主配置檔案
與http的alias差不多的
主配置檔案
-
[root@iZ251xiy3yfZ conf]# more nginx.conf
-
-
#user nobody;
-
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 {
-
server
-
{
-
listen 80;
-
server_name _;
-
root /tmp/fuckyou;
-
location /phpfpm-status
-
{
-
fastcgi_pass 127.0.0.1:9000;
-
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
-
allow 127.0.0.1;
-
deny all;
-
}
-
-
-
location /nginx_status
-
{
-
stub_status on;
-
access_log off;
-
allow 127.0.0.1;
-
deny all;
-
}
-
}
-
server
-
{
-
listen 8080;
-
server_name _;
-
return 403;
-
}
-
-
include vhost/*.conf;
-
}
-
某個域名配置檔案
-
[root@iZ251xiy3yfZ conf]# more vhost/testapi.luobohr.com.conf
-
server {
-
listen 80;
-
server_name testapi.luobohr.com ;
- root /home/wwwroot/api.luobohr.com; ##域名與目錄
-
-
location / {
-
index index.php index.html;
-
if ( !-e $request_filename){
-
rewrite ^/(.*)$ /index.php?s=$1 last;
-
break;
-
}
-
}
-
-
-
location ~ .*\.(php|php5)?$ {
- root /home/wwwroot/api.luobohr.com; 目錄
-
-
try_files $uri =404;
-
fastcgi_pass 127.0.0.1:9000; ----php-fpm埠
-
fastcgi_index index.php;
-
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-
include fastcgi_params;
-
}
-
location ~ /.git
-
{
-
return 403;
-
}
-
location ~* ^/Admin{
-
return 403;
-
}
-
-
location ~* ^/bank{
-
return 403;
- }
- }
與http的alias差不多的
-
cat /etc/httpd/conf.d/zabbix.conf
-
#
-
# Zabbix monitoring system php web frontend
-
#
-
-
Alias /zabbix /usr/share/zabbix
-
-
<Directory "/usr/share/zabbix">
-
Options FollowSymLinks
-
AllowOverride None
-
Require all granted
-
-
<IfModule mod_php5.c>
-
php_value max_execution_time 300
-
php_value memory_limit 128M
-
php_value post_max_size 16M
-
php_value upload_max_filesize 2M
-
php_value max_input_time 300
-
php_value always_populate_raw_post_data -1
-
# php_value date.timezone Europe/Riga
-
</IfModule>
-
</Directory>
-
-
<Directory "/usr/share/zabbix/conf">
-
Require all denied
-
</Directory>
-
-
<Directory "/usr/share/zabbix/app">
-
Require all denied
-
</Directory>
-
-
<Directory "/usr/share/zabbix/include">
-
Require all denied
-
</Directory>
-
-
<Directory "/usr/share/zabbix/local">
-
Require all denied
- </Directory>
訪問http://****/zabbix/ 指向這個目錄
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29096438/viewspace-2123306/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- nginx伺服器配置多個虛擬主機vhost的方法示例Nginx伺服器
- nginx之 nginx虛擬機器配置Nginx虛擬機
- Nginx虛擬主機配置Nginx
- Nginx虛擬主機VirtualHost配置Nginx
- nginx配置檔案Nginx
- Nginx配置檔案解析Nginx
- 【Nginx】nginx虛擬機器設定Nginx虛擬機
- Nginx 配置檔案 nginx.conf 詳解Nginx
- Nginx 配置檔案備忘Nginx
- Nginx配置檔案示例解析Nginx
- nginx配置檔案詳解Nginx
- 1.3.nginx配置檔案Nginx
- 我的Nginx配置檔案Nginx
- 配置nginx多例項(不同於虛擬主機)Nginx
- Nginx 配置檔案 nginx.conf 中文詳解Nginx
- /etc/nginx/nginx.conf配置檔案詳解Nginx
- Nginx配置檔案nginx.conf中文詳解Nginx
- Nginx的配置檔案詳解Nginx
- Nginx的配置檔案說明Nginx
- [轉]Nginx 配置檔案nginx.conf的完整配置說明Nginx
- nginx虛擬域名的配置以及測試驗證Nginx
- Nginx配置之基於域名的虛擬主機Nginx
- 在windows雙系統中,nginx配置虛擬域名WindowsNginx
- 附:Nginx配置檔案nginx.conf中文詳解Nginx
- Nginx配置檔案nginx.conf中文詳解(轉)Nginx
- Nginx配置檔案nginx.conf中文詳解(總結)Nginx
- Nginx虛擬主機常用配置(學習筆記四)Nginx筆記
- Nginx 配置檔案引數詳解Nginx
- Nginx配置檔案的語法格式Nginx
- nginx 基本命令和檔案配置Nginx
- Gixy–分析Nginx配置檔案的工具Nginx
- Nginx配置檔案詳細說明Nginx
- nginx虛擬主機實戰Nginx
- Linux下玩轉nginx系列(二)——nginx配置檔案說明LinuxNginx
- Nginx基礎02:配置檔案nginx.conf(Part1)Nginx
- Nginx的nginx.conf配置檔案中文註釋說明Nginx
- Nginx 虛擬主機配置的三種方式(基於域名)Nginx
- Nginx 配置二級虛擬目錄訪問 Laravel 重寫NginxLaravel