161

To list apache loaded modules use: apachectl -M or: apachectl -t -D DUMP_MODULES or on RHEL,CentoS, Fedora: httpd -M For more options man apachectl. All these answers can be found just by little google search.


112

The sites-* folders are managed by nginx_ensite and nginx_dissite. For Apache httpd users who find this with a search, the equivalents is a2ensite/a2dissite. The sites-available folder is for storing all of your vhost configurations, whether or not they're currently enabled. The sites-enabled folder contains symlinks to files in the sites-available folder. ...


78

You misunderstand port numbers: a server listens only on one port and can have large numbers of open sockets from clients connecting to that one port. On the TCP level the tuple (source ip, source port, destination ip, destination port) must be unique for each simultaneous connection. That means a single client cannot open more than 65535 simultaneous ...


47

I would like to add to the previous answers that the most important is not how you call the directories (though that is a very useful convention), but what you actually put in nginx.conf. Example configuration: http { include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*.conf; include /etc/nginx/sites-enabled/my_own_conf; ... } ...


42

Don't worry about it. Serving a 404 is a tiny, tiny, tiny amount of work for a web server to do. You could probably serve ten 404's a second using a 486. The bandwidth per 404 is negligible; a tiny GET request and a tiny 404 response. Seriously; don't worry about it. This is just part and parcel of running a server on the internet.


42

Bah, I finally found the answer after a long time digging. The problem, in my case wasn't that logrotate was failing. That error message is fine, and doesn't actually stop logrotate. The problem was that nginx was not releasing the file handle to the log file upon receiving the -USR1 signal from kill. Long story short, the reason it was not reloading the log ...


40

The user you specified in your configuration, www, doesn't exist. Either create the user, or choose a user that does exist.


38

Unfortunately for You this is how Internet works. Just ignore it. Thousands of bots/trojans scan the Internet. Source IP will be always random. There is no cure. The only 100% solution for eliminating that traffic is illustrated below: An alternative is: - to move with https/http from port 80/443 to something else. Bots usually don't look for http server ...


36

Typically, the sites-enabled folder is used for virtual host definitions, while conf.d is used for global server configuration. If you're supporting multiple web sites -- i.e., virtual hosts -- then each one gets its own file, so you can enable and disable them very easily by moving files in and out of sites-enabled (or creating and removing symlinks, which ...


32

Before We Begin: Having quality people will save you money. Just like having a good Lawyer (possibly NSFW for swearing) or an accountant, having a quality SysAd will probably save you money, often by simply helping you to avoid costly mistakes. You may not have the money to pay for the expertise now, but as soon as you can, you should make that investment. ...


30

Is there a reason why they are not running as www-data ? Yes. You most likely haven't specified the user in your nginx config. User Directive: http://nginx.org/en/docs/ngx_core_module.html#user syntax: user user [group]; default: user nobody nobody; context: main How to run nginx as a particular user? You can specify the user/group that nginx ...


30

What you want is Fail2ban (assuming this is a linux machine, you didn't say...) What is Fail2ban? Fail2ban will parse system logs, looking for particular regular expressions to block. When it finds a match (or several matches from the same IP, depending on how you configure it), it will block, typically through IPTables. Typically this is used to block ...


29

What's Going On? You must be using Debian or Ubuntu, since the evil sites-available / sites-enabled logic is not used by the upstream packaging of nginx from http://nginx.org/packages/. In either case, both are implemented as a configuration convention with the help of the standard include directive in /etc/nginx/nginx.conf. Here's a snippet of /etc/nginx/...


29

Originally, the web server didn't know. This was the reason that you needed a separate IP address for every SSL vhost you wanted to host on the server. This way, the server knew that when a connection came in on IP X, he needed to use the configuration (including certificates) for the associated vhost. This changed with Server Name Indication, a TLS ...


29

NFS is fine, barring some specific other criteria are met, namely: The systems involved are both able to use NFS natively. Windows doesn't count here, it kind of works, but it's got a lot of quirks and is often a pain to work with when dealing with NFS in a cross-platform environment (and if it's just Windows, use SMB3, it eliminates most of the other ...


28

Here's what the documentation says: $request_filename This variable is equal to path to the file for the current request, formed from directives root or alias and URI request; $document_root This variable is equal to the value of directive root for the current request; $fastcgi_script_name This variable is equal to the URI request or, if if the ...


27

The website runs on a server process. When you shut down the server process, the server does not magically turn off. Also not when you misconfigure your firewall (and block port 80) neither does the server go off nor does the ICMP rule in the firewall get deleted.


24

Section 9.6 "Overcommit and OOM" in the doc that @dunxd mentions is particularly graphic on the dangers of allowing overcommit. However, the 80 looked interesting to me as well, so I conducted a few tests. What I found is that the overcommit_ratio affects the total RAM available to ALL processes. Root processes don't seem to be treated differently from ...


23

Most efficient and clean way to do this is to configure two separate server{} blocks - one to do redirects, and another one (with canonical name) to actually handle requests. Example configuration: server { listen 80; listen 443 ssl; server_name xxx yyy.example.com $hostname; ssl_certificate ... ssl_certificate_key ... return 302 ...


22

I had the very same problem. Setting localhost redirect to 127.0.0.1 in hosts file did not help. Optimizing MySQL server did not help (InnoDB -> MyISAM, changing many cache related directives in my.ini). Then I used web webgrind and narrowed down the problem to "new PDO(...)" call. Changing mysql:host=localhost;dbname=dp-ui;charset=utf8 to mysql:...


22

Host names do not correspond to an {ipaddress,port} tuple. A host name is only the name of a server, which should be resolvable to one or more IP addresses. Ports have nothing to do with host names at all.


21

The author lists their reasoning, although it's a bit disjoint. Their primary argument is that it's easy to accidentally check in a config file, and that config files have varying formats and may be scattered around the system (all three of which are at best mediocre arguments for security related config like auth tokens and credentials). Given my own ...


20

This has got to be one of the most misunderstood things about RHEL/CentOS (the two are effectively interchangeable for the purposes of this post). CentOS is an OS. CentOS 6 is a version of that OS; it's very different from CentOS 5. CentOS 6.1 isn't an OS version, it's just a patch level of CentOS 6. To understand that, you have to understand Red Hat's ...


19

First of all you need to think about your network design. It would be good to use at least one DMZ in oder to protect the internal network. A good Windows system for beeing public would be Windows Server 2008 R2 if you do not want to purchase the new 2012 Server. We have at least four windows based webservers which work perfectly as webservers, all based on ...


19

There's no simple solution to this - its probably going to be a long and annoying road to getting everything moved. I'd start with a few things, but the book I recommended in the comments likely goes into a few details. I see four main stages here - inventory, redeployment, testing, and acceptance. What am I hosting right now If you haven't already, do a ...


18

I just came across this answer from StackOverflow. Basically, python's webserver is not configured to run php files by default, but instead of trying to reconfigure python's web server, you can simply run php's web server, which works almost exactly like python's simplehttpserver, with php [options] -S <addr>:<port> [-t docroot] Example: ...


18

You are mistaken - the socket's uniqueness is determined by four factors: the local IP address the local port number the remote IP address the remote port number When offering network services, 1. and 2. typically are static (e.g. IP 10.0.0.1, port 80) but unless you are expecting thousands of connections from a single client (or a single NAT gateway), you ...


18

Are you sure that the Nginx user has access to the directory? Also check the permissions of the .pem file, if Nginx cannot access it, it can show as 'no such file or directory'. If the permissions are right, you might check the actual path again. How you pasted it (which I know you removed the dir) there is no beginning / which could be the problem. EDIT ...


17

The answer is basically: It depends. In your specific case, the quality & efficiency of the sites you have installed can come into question. For example, this week I was working on a server that is relatively moderate traffic, yet eating up 4GB of RAM. After doing a code review—the whole site is using an off-the-shelf CMS similar to WordPress but with ...


17

NFS is absolutely OK and is preferred over iSCSI due to the fact NFS is much easier to manage, share and backup.


Only top voted, non community-wiki answers of a minimum length are eligible